android - TextView 填充点

标签 android layout textview

对不起我的英语

我有一个 RelativeLayout 和 2 个类似的 TextView

<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_weight="1"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView9"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView10"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:singleLine="true"
                android:textAppearance="?android:attr/textAppearanceMedium" />

        </RelativeLayout>

我想用点来分隔这两个元素。像那样:

TextView9 ..................................... TextView10

其他文本更长...................................... 69

最佳答案

没有java代码:

drawable/dotted.xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">

    <stroke
       android:color="#C7B299"
       android:dashWidth="10px"
       android:dashGap="10px" />
</shape>

View .xml:

<View
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/dotted" />

同时设置:

view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

关于android - TextView 填充点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16551085/

相关文章:

android - 飞溅 Activity 而不是白屏

java - 在 TextView 和 EditText 之间切换

android - setText 使应用程序意外停止

android - 如何自定义出现在 android 3.0 honeycomb 操作栏中的应用程序图标和标签

android - 使用 calabash-android 解锁图案

android - 检查当前点是否在路线(路径)上并从匹配的列表中获取这些点

安卓自定义按钮

android - 具有复杂数据和每行复杂布局的复杂 ListView 示例?

android - 以编程方式切换应用程序范围的主题?

swift - 当 Swift 中的 textView 必须适合整个屏幕时,如何正确调整它的大小?