Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/216.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 布局中的webview,顶部有4个文本视图_Java_Android_Xml_Layout - Fatal编程技术网

Java 布局中的webview,顶部有4个文本视图

Java 布局中的webview,顶部有4个文本视图,java,android,xml,layout,Java,Android,Xml,Layout,我对屏幕布局xml没有太多经验。我想这样显示我的屏幕: 注:我会添加文本标签3和标签4(红色)。它们在图中,但不在xml中,因为我无法对齐它们 将有助于将这两个文本视图放在我下面的布局中: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="f

我对屏幕布局xml没有太多经验。我想这样显示我的屏幕:

注:我会添加文本标签3和标签4(红色)。它们在图中,但不在xml中,因为我无法对齐它们

将有助于将这两个文本视图放在我下面的布局中:

  <?xml version="1.0" encoding="utf-8"?>
  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:theme="@android:style/Theme.Dialog"
     android:layout_height="fill_parent" >

    <WebView
        android:id="@+id/id_web_view_browser"
        android:layout_above="@+id/id_web_view_bar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

    <RelativeLayout
        android:id="@+id/id_web_view_bar"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_alignParentBottom="true"
        android:background="#ffffff"
        android:orientation="vertical" >
        <Button
            android:id="@+id/btnCancelar"
            android:background="@drawable/btn_red"
            android:layout_width="fill_parent"
            android:layout_centerHorizontal="true"
            android:layout_height="wrap_content"
            android:text="     Cancelar Corrida      "
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:textSize="20sp" />

    </RelativeLayout>

<RelativeLayout
            android:id="@+id/relativeLayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:gravity="top">
            <TextView 
                android:id="@+id/txtLabel1"
                android:layout_alignParentLeft="true"
                android:layout_height="wrap_content"
                android:background="#ffffff"
                android:maxLines="1"
                android:layout_width="wrap_content"
                android:text="Label1: Sample1">
            </TextView>
            <TextView
                android:id="@+id/txtLabel2"
                android:layout_alignParentRight="true"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:background="#ffffff"
                android:text="Label2: Sample2">
            </TextView>

</RelativeLayout>

</RelativeLayout>

将它们放在android:id=“@+id/relativeLayout1”相对布局中,并使用下面的布局。应该很直接地工作


    <?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:theme="@android:style/Theme.Dialog" >

    <WebView
        android:id="@+id/id_web_view_browser"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/id_web_view_bar"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true" />

        <RelativeLayout
            android:id="@+id/id_web_view_bar"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:layout_alignParentBottom="true"
            android:background="#ffffff"
            android:orientation="vertical" >

            <Button
                android:id="@+id/btnCancelar"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:layout_marginLeft="10dp"
                android:background="@drawable/btn_red"
                android:text=" Cancelar Corrida      "
                android:textSize="20sp" />
        </RelativeLayout>

        <TableLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginTop="16dp" >

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    android:id="@+id/txtLabel1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:background="#ffffff"
                    android:maxLines="1"
                    android:text="Label1: Sample1" >
                </TextView>

                <TextView
                    android:id="@+id/txtLabel2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="115dp"
                    android:layout_marginRight="5dp"
                    android:background="#ffffff"
                    android:text="Label2: Sample2" >
                </TextView>
            </TableRow>

            <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp" >

                <TextView
                    android:id="@+id/txtLabel3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:background="#ffffff"
                    android:maxLines="1"
                    android:text="Label1: Sample1" >
                </TextView>

                <TextView
                    android:id="@+id/txtLabel4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="115dp"
                    android:layout_marginRight="5dp"
                    android:background="#ffffff"
                    android:text="Label2: Sample2" >
                </TextView>
            </TableRow>
        </TableLayout>

    </RelativeLayout>