Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.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
Android 在tablet视图中创建活动中心的xml布局,并将边框包围_Android - Fatal编程技术网

Android 在tablet视图中创建活动中心的xml布局,并将边框包围

Android 在tablet视图中创建活动中心的xml布局,并将边框包围,android,Android,如何为中心活动创建xml布局,并在tablet视图中包围边框,如此处链接的图片:(以红色指定) 我想把我的活动放在中间,两边各放两列 是否有创建此布局的标准方法 像这样创建布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"

如何为中心活动创建xml布局,并在tablet视图中包围边框,如此处链接的图片:(以红色指定)

我想把我的活动放在中间,两边各放两列
是否有创建此布局的标准方法

像这样创建布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#f5f5f5" >
    </LinearLayout>

    <View
        android:layout_width="2dp"
        android:layout_height="match_parent"
        android:background="#000000" />
    <!-- Activity layout -->

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="2" >
    </LinearLayout>

    <View
        android:layout_width="2dp"
        android:layout_height="match_parent"
        android:background="#000000" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="#f5f5f5" >
    </LinearLayout>

</LinearLayout>


只需替换背景中的颜色代码即可获得所需的显示。

您好,如何将阴影添加到边框?请检查此答案以将阴影添加到边框。