use*_*048 3 android android-layout
这是我的代码,下面显示textview中心的虚线,我想在textview下面显示如下:

如何将其更改为显示在textview虚线下方
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/apprentTemp"
android:textColor="#000000"
android:background="@drawable/dotted"
android:paddingLeft="10dp"
android:gravity="left"/>
<TextView
android:id="@+id/localTime"
android:textColor="#000000"
android:background="@drawable/dotted"
android:gravity="center"/>
</TableRow>
<---- dashed.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#000000"
android:dashWidth="5px"
android:dashGap="5px" />
</shape>
Run Code Online (Sandbox Code Playgroud)
用
android:drawableBottom="@drawable/dotted"
Run Code Online (Sandbox Code Playgroud)
反而
android:background="@drawable/dotted"
Run Code Online (Sandbox Code Playgroud)
编辑:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:left="-5dp"
android:right="-5dp"
android:top="-5dp">
<shape
android:shape="rectangle">
<stroke
android:width="1dp"
android:dashGap="5dp"
android:dashWidth="5dp"
android:color="@android:color/black" />
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
试试这个
dashed.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line" >
<stroke
android:dashGap="2dip"
android:dashWidth="2dip"
android:color="@android:color/black" />
<size android:width="60dp"
android:height="6dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)
然后用
android:drawableBottom="@drawable/dashed"
Run Code Online (Sandbox Code Playgroud)
在你的 TextView
代替
android:background="@drawable/dotted"
输出:

| 归档时间: |
|
| 查看次数: |
4537 次 |
| 最近记录: |