Ich habe ein seltsames Verhalten, dessen Quelle ich nicht genau bestimmen kann.
Ich habe meine App mit dem Klassiker
requestWindowFeature(Window.FEATURE_NO_TITLE);
um die Titel- / Statusleiste zu entfernen.
Ich erstelle dann ein Dialogfeld, in dem der Benutzer Informationen (Name usw.) eingeben kann.
Mit einer physischen Tastatur kein Problem, aber wenn ich die virtuelle Tastatur verwende, habe ich ein seltsames Verhalten:
Jedes Mal, wenn ich eine Taste auf der virtuellen Tastatur drücke, wird die Titel- / Statusleiste erneut angezeigt, wobei das gesamte Tastaturlayout verschoben wird, und verschwindet dann wieder (genau wie die Animation beim Starten der Anwendung).
Hier ist ein Code:
dialog = new Dialog(context);
dialog.setContentView(R.layout.logindialog);
dialog.setTitle("Login:");
WindowManager.LayoutParams a = dialog.getWindow().getAttributes();
// dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
a.dimAmount = 0;
dialog.getWindow().setAttributes(a);
dialog.setCancelable(true);
dialog.getWindow().setLayout(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
und dann
dialog.show();
Ich habe es versucht
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
aber es stürzt meine App ab.
Hier ist die XML
<TextView android:id="@+id/LoginText"
android:gravity="fill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login:">
</TextView>
<EditText android:id="@+id/LoginEdit"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="jason"
android:layout_width="200sp"/>
<TextView android:id="@+id/PasswordText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password:">
</TextView>
<EditText android:id="@+id/PasswordEdit"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="welcome"
android:layout_width="200sp"
android:password="true"/>
<LinearLayout
android:id="@+id/test2"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="@+id/LoginButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Login" />
<Button android:id="@+id/CreateButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Create" />
<Button android:id="@+id/CancelLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Cancel" />
</LinearLayout>/>