Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/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开发新手,我想在android中制作一个屏幕,如下所示: 有谁能帮我做到这一点: ImageView从左、右和顶部留出20px的空间。 空间 文本视图。 空间 文本视图1。 空间 TextView2:TextView3。 空间 。 . 如果不存在imageView,则应显示文本视图并隐藏imageView。示例: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http:

我是android开发新手,我想在android中制作一个屏幕,如下所示:

有谁能帮我做到这一点:

ImageView从左、右和顶部留出20px的空间。 空间 文本视图。 空间 文本视图1。 空间 TextView2:TextView3。 空间 。 .

如果不存在imageView,则应显示文本视图并隐藏imageView。

示例:

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

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dip"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:layout_marginTop="20dip" 
        android:src="@drawable/img"/>

    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dip"
        android:layout_marginLeft="2dip"
        android:layout_marginRight="2dip"
        android:layout_marginTop="5dip" 
        android:text="Txt1"/>
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dip"
        android:layout_marginLeft="2dip"
        android:layout_marginRight="2dip"
        android:layout_marginTop="5dip" 
        android:text="Txt2"/>
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dip"
        android:layout_marginLeft="2dip"
        android:layout_marginRight="2dip"
        android:layout_marginTop="5dip" 
        android:text="Txt3"/>

</LinearLayout>

带方向的线性布局:垂直如何从顶部和左侧留出空间您可以使用边距