![](/img/trans.png)
[英]windowSoftInputMode not working inside scrollView android
[英]android scrollview not working windowSoftInputMode
我有一個活動,在此活動的窗口中,SoftInputMode為stateAlwaysHidden
android:windowSoftInputMode="stateAlwaysHidden"
我創建了自定義Xml文件,在此xml中,我在頂部位置有一個edittext,在底部位置有一個按鈕
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:minHeight="@dimen/u_base_min_height">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:minHeight="@dimen/u_base_min_height"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/transfer_headerView_height">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical"
android:paddingLeft="@dimen/u_common_margin_left"
android:paddingRight="@dimen/u_common_margin_right">
<Button
android:id="@+id/u_done"
android:layout_width="fill_parent"
android:layout_height="@dimen/u_widget_height"
android:background="@drawable/rounded_corners_blue"
android:text="@string/u_register_next"
android:textColor="#ffffff"
android:textSize="@dimen/u_common_text_size" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/u_common_margin_left" />
</LinearLayout>
</RelativeLayout>
當鍵盤顯示時,我無法顯示我的按鈕是否處於最低位置,scrollview現在可以工作了。 我搜索了我的問題,然后嘗試更改清單文件android:windowSoftInputMode="adjustResize"
但是我不需要此解決方案,因為當鍵盤顯示時我的按鈕將鍵盤向上移動...我該如何解決我的問題? 如果有人知道解決方案,請幫助我,謝謝大家
為此使用下面的代碼
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true">
將您的底部按鈕放在滾動視圖之外。 進行兩個單獨的布局。 在上部布局中,放置您的滾動視圖內容,在下部布局中,放置您的底部按鈕。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.