这是我的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 –