請考慮以下帶有一個可滾動TextView和其下的兩個按鈕的XML佈局。線性佈局 - 按鈕消失
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="@+id/description"
android:scrollbars = "vertical"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button2"
/>
</LinearLayout>
</LinearLayout>
TextView動態更新。如果TextView內容適合屏幕,按鈕將很好地顯示出來。但是,只要TextView內容超出屏幕大小以使用滾動條,底部的按鈕就會消失。
如何確保按鈕始終顯示,滾動條或沒有滾動條?
你可以保持您的按鈕TextView的,並在LinearLayout中滾動型。 –
thnks,但我希望按鈕始終可見,只有Textview可滾動 – oat