這是我的XML代碼(我遵循了這一post,但它不工作):按鈕沒有顯示
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/webChapter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_below="@+id/webChapter"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/btnMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Back To Menu" />
<Button
android:id="@+id/btnNavi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Example" />
<Button
android:id="@+id/btnQuestion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quiz" />
</LinearLayout>
這是圖形之一:
當我的webview變得太高時,我的按鈕不顯示。我該怎麼辦?謝謝:D
謝謝:d 但是,什麼是不同的採用了android的:layout_below = 「webviewid」 和android:layout_above = 「linearid」?爲什麼第一個不工作,但第二個工作? –
@BlazeTama通過設置android:layout_below =「webviewid」,您可以指定您的佈局位於您的webview下方,但是如果您的webview太大,您的佈局將不在屏幕上。通過設置android:layout_above =「linearid」,您可以指示您的webview位於佈局之上。我知道一開始我很難理解(我記得:p),但我唯一可以做的建議是不斷練習,它會讓你更清楚。另一種方式是用垂直線性替換你的relativelayout,使你的webview 0dp高度和1weight,以及wrap_content線性化。 – AMerle
感謝您的解釋,是的它有點難,但你的解釋讓我更好地理解:D –