有一個問題試圖讓一些按鈕出現在我放在一起的應用程序的srcollview下。Android:LinearLayout不會出現在滾動查看
帶按鈕的底部LinearLayout根本沒有出現在屏幕上,它無疑是明顯的,但我現在很難過。我認爲通過使用RelativeLayout作爲主頁面的父項,然後使用android:layout_below屬性,我可以很容易地定位它們?
<?xml version="1.0" encoding="utf-8"?>
<!-- ViewFlipper -->
<ViewFlipper
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ViewFlipper01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!-- Page 1 (Splash) -->
<LinearLayout
android:id="@+id/splashPage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Display Splash Image"/>
</LinearLayout>
<!-- Page 2 (Main) -->
<RelativeLayout
android:id="@+id/mainPage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/mainPage"
>
<TextView
android:id="@+id/date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
</LinearLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/header"
>
<TableLayout
android:id="@+id/tableHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<!-- Dynamic TextViews Will Go In Here -->
</TableLayout>
</ScrollView>
<LinearLayout
android:id="@+id/buttonHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@+id/scrollView"
>
<Button
android:id="@+id/previous"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Previous" />
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next" />
</LinearLayout>
</RelativeLayout>
</ViewFlipper>
<!-- End of ViewFlipper -->
這使得他們出現,但在滾動視圖內容 – cosmicsafari 2013-02-28 18:04:13
嗯...我想我會嘗試暫時刪除了'ScrollView',只是保持'TableLayout的頂部有浮' - 並將'ScrollView'的佈局參數複製到'TableLayout'中。這將消除可能帶有滾動控件的任何異常情況。一旦你得到了這個工作,那麼你可以把滾動視圖放回去。如果它不起作用,那麼你會知道它是滾動視圖特定的。 – 2013-02-28 18:19:30
哦,還有一件事情,雖然不會導致你的問題 - 你的第一個'標題'的'LinearLayout'可以被刪除。在TextView中使用android:layout_centerHorizontal =「true」。 – 2013-02-28 18:24:37