我有一些元素的滾動視圖,其中一個 - 編輯文本,靠近佈局的底部。 當這editText請求通過點擊 - 軟鍵盤打開並重寫editText fild,所以用戶不能看到他打字什麼...SoftKeyboard覆蓋editText
任何想法爲什麼發生和如何解決它?
這裏是我的代碼清單:
<activity
android:name=".acitivity.TransferActivity"
android:label="@string/title_activity_transfer"
android:theme="@style/AppTheme.NoActionBar"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
</activity>
這裏是活動的xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_transfer"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container_transfer_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_transfer" />
</LinearLayout>
這裏是片段的xml:
<ScrollView
android:id="@+id/transfer_scroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blue_500"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
//some code here
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
//some code here
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<EditText
android:id="@+id/et_transfer_p1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:inputType="number"
android:textColor="@color/gray_400"
android:textSize="@dimen/font_main_2" >
</EditText>
</LinearLayout>
</LinearLayout>
</ScrollView>
也許你設置'機器人。請添加您的styles.xml。 – ywwynm
嘗試與Android:windowSoftInputMode =「adjustPan」在清單 – Pavan
看看這裏http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft - 你可能需要添加(adjustUnspecified) – Tasos