[英]Android UI overlap Issue
我目前具有如图所示的布局,但是(如xml中所示),WebView具有预定义的layout_height值。 我只是想要这种确切的外观,而是一个不需要预定义值的可扩展版本。 因此,明亮的蓝色部分的高度应与按钮成比例,并且应始终在底部,而带有URL EditText等的顶部栏应以相同的方式起作用。 因此,WebView应该能够缩放到任意大小,以确保占用所有空间。
<FrameLayout 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"
android:background="@android:color/black"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/fullscreen_content_controls"
style="?buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dp"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<EditText
android:id="@+id/editText1"
android:layout_width="284dp"
android:layout_height="wrap_content"
android:layout_weight="0.97"
android:ems="10"
android:hint="Enter URL"
android:imeOptions="actionGo"
android:singleLine="true"
android:textColor="@android:color/darker_gray"
android:inputType="textNoSuggestions">
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="30dp"
android:layout_height="31dp"
android:layout_marginRight="5dp"
android:background="@android:drawable/btn_dialog" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/android:progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.10" />
</LinearLayout>
</FrameLayout>
<WebView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="724dp"
android:layout_gravity="center"
android:layout_weight="0.75"
android:keepScreenOn="true" />
<LinearLayout
android:id="@+id/controlLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.97"
android:background="@android:color/holo_blue_bright" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
用这个...
<LinearLayout 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"
android:background="@android:color/black"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/fullscreen_content_controls"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/editText1"
android:layout_width="284dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:ems="10"
android:hint="Enter URL"
android:imeOptions="actionGo"
android:inputType="textNoSuggestions"
android:singleLine="true"
android:textColor="@android:color/darker_gray" >
</EditText>
<Button
android:id="@+id/button1"
android:layout_width="30dp"
android:layout_height="31dp"
android:layout_marginRight="5dp"
android:layout_weight="0.1"
android:background="@android:drawable/btn_dialog" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/android:progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.1" />
</LinearLayout>
<LinearLayout
android:id="@+id/controlLinearLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.8"
android:background="@android:color/holo_blue_bright"
android:orientation="vertical" >
<WebView
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:keepScreenOn="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/ctl"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:background="@android:color/holo_blue_bright" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.