Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.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
在两个水平放置在linearlayout-android中的imageview之间绘制线或放置imageview_Android - Fatal编程技术网

在两个水平放置在linearlayout-android中的imageview之间绘制线或放置imageview

在两个水平放置在linearlayout-android中的imageview之间绘制线或放置imageview,android,Android,我想在两个图像之间画一条线 我使用重量将3ImageView水平放置在LinearLayout中,所有屏幕的中心对齐 我的问题是我想在两个图像之间画一条线,这两个图像应该是相互接触的 我不知道如何在线性布局中使用权重创建的两个图像之间绘制直线或放置直线图像。请帮助我,提前谢谢。只需在图像视图之间放置视图即可 <View android:layout_width="match_parent" android:layout_height="2dp" android

我想在两个图像之间画一条线

我使用重量将3
ImageView
水平放置在
LinearLayout
中,所有屏幕的中心对齐

我的问题是我想在两个图像之间画一条线,这两个图像应该是相互接触的


我不知道如何在线性布局中使用权重创建的两个图像之间绘制直线或放置直线图像。请帮助我,提前谢谢。

只需在图像视图之间放置视图即可

<View
     android:layout_width="match_parent"
     android:layout_height="2dp"
     android:background="@color/gray" />

垂直分隔器:

<View
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="@color/divider_color"
    android:id="@+id/vertical_divider"/>
<View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/divider_color"
        android:id="@+id/horizontal_divider"/>

水平分隔器:

<View
    android:layout_width="match_parent"
    android:layout_height="1dp"
    android:background="@color/divider_color"
    android:id="@+id/vertical_divider"/>
<View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@color/divider_color"
        android:id="@+id/horizontal_divider"/>

用法示例:

<LinearLayout 
                    android:layout_width="match_parent" 
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <ImageView 
                            android:layout_width="wrap_content" 
                            android:layout_height="wrap_content"
                            android:id="@+id/img_1"/>

                    <View
                            android:layout_width="match_parent"
                            android:layout_height="1dp"
                            android:background="@color/divider_color"
                            android:id="@+id/vertical_divider1"/>

                    <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/img_2"/>

                    <View
                            android:layout_width="match_parent"
                            android:layout_height="1dp"
                            android:background="@color/divider_color"
                            android:id="@+id/vertical_divider2"/>

                    <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/img_3"/>

            </LinearLayout>


将三个图像视图放置在相对位置,然后进行对齐或设置填充设置视图之间的图像视图。谢谢大家的回答,我尝试过了,但我希望三个图像的权重相同,并且两个图像上的线条应该接触,这是我面临的问题。