Android 如何在框架布局上方显示线性布局?
我的XML代码:Android 如何在框架布局上方显示线性布局?,android,android-layout,Android,Android Layout,我的XML代码: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#777777" andr
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#777777"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dip"
android:layout_alignParentTop="true"
android:gravity="left|bottom"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="00:00:00"
android:textColor="#ffffff" />
</LinearLayout>
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="110dp"
android:background="#000000" >
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:gravity="center|top"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/button_Rotation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/my_progress_interminate" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
如何显示文本视图
txtTime
上方FrameLayout
相同的按钮按钮旋转
?我已通过移动布局将文本视图向下移动到FrameLayout下方:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#777777"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="110dp"
android:background="#000000" >
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dip"
android:layout_alignParentTop="true"
android:gravity="left|bottom"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="00:00:00"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:gravity="center|top"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="@+id/button_Rotation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/my_progress_interminate" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
外部线性布局,除非,然后在您的相对位置 第一个选项是:android:layout_alignParentTop=“true”,并设置一个id(@+id/rl) 第二帧布局:android:layout_下方=“@id/rl” 第三行布局:android:layout_below=“@id/camera_view”
就这些!祝你好运 这是最简单的方法:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FAFFD5" >
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="vertical"
android:background="@drawable/textlayout_outline"
android:layout_margin="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/are_you_looking_for_something" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tap_here" />
</LinearLayout>
由于它们处于相对位置,您可以使用下面的布局来使一件东西的布局低于另一件。也可以将它们放置在线性布局中。框架布局的高度也是匹配的。如果要将内容一个接一个地显示,请将其更改为“换行”。