我試圖做的唯一事情就是在頂部會有一個editText,然後會有一個ImageView。 現在最後一行會出現一些按鈕(例如表情符號),只有在軟鍵盤出現時纔會將其底部向上推。當軟鍵盤出現時,只將底部向上推
我通過附加Facebook的佈局使其更加清晰。 required output
我已經經歷了所有這些SO問題,也嘗試了他們的答案,但沒有運氣。可能是我做錯了什麼。
Android: Resize only parts of view with soft keyboard on screen
Android: How do I prevent the soft keyboard from pushing my view up?
android : How to prevent resizing the window when displaying the virtual keyboard
我的XML代碼
<ScrollView
android:id="@+id/scrollOnPost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="false"
android:fillViewport="true"
android:layout_below="@+id/header_layout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="4"
android:layout_gravity="bottom"
android:gravity="bottom">
<EditText
android:id="@+id/ed_post"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ImageView
android:id="@+id/img_posted_list_row"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.7"
android:adjustViewBounds="true"
android:src="@mipmap/ic_launcher"
android:scaleType="fitCenter"
android:background="@color/red"/>
</LinearLayout>
</ScrollView>
<ImageButton
android:id="@+id/imgBtn_Emoji"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:src="@drawable/smile_face"
android:background="@drawable/button_pressed_white"
/>
所有我得到我的軟鍵盤總是把整個佈局了不是在底部剛表情符號。謝謝。
看到這個鏈接它可能會幫助你:http://stackoverflow.com/questions/17410499/difference-between-adjustresize-and-adjustpan-in-android –
感謝鏈接庫納爾。我已經嘗試了「adjustResize」,「adjustPan」,並且兩者都在清單中,但結果不是我所需要的。但問題是我有同樣的問題。再次感謝。 –
@ Md。Asaduzzaman Noor il嘗試在我的代碼中添加布局,以及c我可以找到什麼解決方案 –