Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.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屏幕布局_Android_Android Layout - Fatal编程技术网

使用android屏幕布局

使用android屏幕布局,android,android-layout,Android,Android Layout,我正在努力掌握android的布局,首先,有谁能给我介绍一个关于在屏幕上使用布局的好的基础教程吗。当我阅读GoogleLayoutDevRef时,我理解了这些概念,但是来实践一下,我不太明白 我正试图在Android屏幕上复制以下布局,我相信我需要在其他屏幕中嵌套不同的布局,但我不能完全得到我必须的外观: 任何关于类似代码的建议,以及让我开始学习的教程,都是非常好的thx使用文本视图、按钮、图像视图作为子级,使用线性布局作为父级,并使用权重处理区域分配子级内容: <LinearLayou

我正在努力掌握android的布局,首先,有谁能给我介绍一个关于在屏幕上使用布局的好的基础教程吗。当我阅读GoogleLayoutDevRef时,我理解了这些概念,但是来实践一下,我不太明白

我正试图在Android屏幕上复制以下布局,我相信我需要在其他屏幕中嵌套不同的布局,但我不能完全得到我必须的外观:


任何关于类似代码的建议,以及让我开始学习的教程,都是非常好的thx

使用文本视图、按钮、图像视图作为子级,使用线性布局作为父级,并使用权重处理区域分配子级内容:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="10dp">

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

        <ImageView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:scaleType="fitXY"
            android:src="@drawable/ic_launcher"/>
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="vertical">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="textview"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="textview"
                android:layout_marginTop="5dp"/>
        </LinearLayout>

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.60"
        android:orientation="vertical">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="textview"
            android:layout_marginTop="5dp"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="textview"
            android:layout_marginTop="5dp"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp">
            <TextView
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:text="textview"/>
             <Button
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:text="button"/>
        </LinearLayout>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="textview"
            android:layout_marginTop="5dp"/>
    </LinearLayout>

</LinearLayout>

(黑色-线性垂直布局) (红色-线性水平布局) (绿色-图像视图) (黄色-文本视图) (棕色按钮)


先想象一下。然后编写xml。

使用线性和相对布局组合。。这将帮助你。@makapaka,很高兴帮助你。