【发布时间】:2011-12-13 03:43:37
【问题描述】:
我有一个自定义标题栏,所以我希望当用户在登录活动中键入用户名和密码时,标题栏不应该隐藏。但是,不幸的是它确实被隐藏了。我尝试使用android:windowSoftInputMode= "adjustPan,但标题栏仍然被隐藏。
那么,如何同时显示标题栏和软键盘?
这是我的屏幕截图,
这是我的登录活动
这是当我点击 EditText 并且标题栏被隐藏时。
这是我用于登录活动的 xml。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<TableLayout android:id="@+id/tbl_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_marginRight="5dip"
android:layout_marginLeft="5dip" android:layout_centerInParent="true">
<TableRow android:weightSum="10">
<TextView android:layout_weight="3" android:layout_width="0dp"
android:layout_height="wrap_content" android:text="Username:"
android:textColor="@color/dark_purple" />
<EditText android:id="@+id/et_username"
android:layout_weight="7" android:layout_width="0dp"
android:layout_height="wrap_content" android:hint="Username"
android:singleLine="true"
android:background="@drawable/edit_text_select"
android:padding="8dip"
/>
</TableRow>
<TableRow android:weightSum="10" android:layout_marginTop="10dip">
<TextView android:layout_weight="3" android:layout_width="0dp"
android:layout_height="wrap_content" android:text="Password:"
android:textColor="@color/dark_purple" />
<EditText android:id="@+id/et_password"
android:layout_weight="7" android:layout_width="0dp"
android:layout_height="wrap_content" android:hint="Password"
android:singleLine="true"
android:password="true"
android:padding="8dip"
android:background="@drawable/edit_text_select"/>
</TableRow>
</TableLayout>
<LinearLayout android:layout_below="@id/tbl_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="right"
android:layout_marginTop="10dip">
<Button android:id="@+id/btn_login"
android:layout_height="wrap_content"
android:layout_width="wrap_content" android:padding="15dp"
android:text="Login" android:layout_marginRight="15dip"
android:onClick="myOnClick"
android:textColor="@android:color/white"
android:background="@color/dark_purple"/>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
作为一个高效的 stackoverflow 用户,当您遇到问题时,您应该在此处发布 XML 布局。
标签: android android-layout android-emulator android-widget android-manifest