Android draw a Horizontal line between views

前端 未结 15 2256
不知归路
不知归路 2020-12-12 12:28

I have My Layout like below:




        
相关标签:
15条回答
  • 2020-12-12 13:12

    add something like this in your layout between the views you want to separate:

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

    Hope it helps :)

    0 讨论(0)
  • 2020-12-12 13:12

    Try this

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/darker_gray"/>
    
    0 讨论(0)
  • 2020-12-12 13:13

    In each parent LinearLayout for which you want dividers between components, add android:divider="?android:dividerHorizontal" or android:divider="?android:dividerVertical.

    Choose appropriate between them as per orientation of your LinearLayout.

    Till I know, this resource style is added from Android 4.3.

    0 讨论(0)
  • 2020-12-12 13:14

    Try this works for me

     <View android:layout_width="1dp"
           android:layout_height="match_parent"
           android:background="@color/tw_composer" />
    
    0 讨论(0)
  • 2020-12-12 13:14

    A View whose background color you can specify would do (height=a few dpi). Looked in real code and here it is:

            <LinearLayout
                android:id="@+id/lineA"
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000000" />
    

    Note that it may be any kind of View.

    0 讨论(0)
  • 2020-12-12 13:16
    <View
           android:id="@+id/view"
           android:layout_width="match_parent"
           android:layout_height="2dp"
           android:background="#000000" />
    
    0 讨论(0)
提交回复
热议问题