【问题标题】:How to add so many divider?如何添加这么多分隔符?
【发布时间】:2016-10-16 14:55:25
【问题描述】:

大家好,我有一个只有相对布局的应用,我有很多中等大小的文字,比如我有十个中等大小的文字。

我想在每个文本下方添加一个分隔符/分隔符。

我试过了

<View
android:layout_width = "match_parent"
android:layout_height = "1dp"
android:background="?android:attr/listDivider"/>

但是每次手动安排它们对我来说非常困难。我必须在很多不同的活动中这样做

所以请提前告诉我最简单的方法,谢谢。

【问题讨论】:

    标签: android divider


    【解决方案1】:

    使用RelativeLayout 并包含android:layout_below 使其在文本下方对齐。

     <TextView
            android:id="@+id/textidhere"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>
     <View
            android:id="@+id/divider"
            android:layout_width="match_parent"
            android:layout_height="1dip"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:background="#dcddde"
            android:layout_below="@id/textidhere"/>
    

    【讨论】:

    • 很高兴能够提供帮助。 :)
    猜你喜欢
    • 2013-08-20
    • 1970-01-01
    • 2015-12-08
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-20
    • 2012-04-16
    相关资源
    最近更新 更多