gpt4 book ai didi

android - TextView 填充点

转载 作者:行者123 更新时间:2023-12-04 18:09:58 24 4
gpt4 key购买 nike

对不起我的英语

我有一个 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com