Bjö*_*örn 29 user-interface android textview
我有一个TextView,我用strings.xml中的字符串资源填充文本.字符串资源包含<li>元素,用于在TextView中创建项目符号列表.我的问题是我想控制子弹列表中跨越多行的行的缩进.默认情况下,文本不会缩进子弹,所以它看起来很难看.是否可以使用样式参数执行此操作或以其他方式创建项目符号?
提前致谢.
编辑:真的回答了吗?我在制作子弹列表时没有任何问题,如这些链接所述,但我在设置布局方面遇到了问题.缩进是这样的:
而且我希望"线条"至少开始缩进到子弹后的文本.这就是我试图实现的目标.
Bjö*_*örn 23
我很惊讶似乎没有人遇到这个问题.我的意思是,子弹列表在约会对话框,常见问题解答等中并不常见,并且子弹不必包含太多文本以跨越多行并遇到此问题.
无论如何,我现在必须这样解决它:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/ScrollViewTipsLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TipsLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableLayout
android:layout_height="wrap_content"
android:id="@+id/TableLayout01"
android:layout_width="wrap_content"
>
<TableRow>
<TextView android:id="@+id/tvIngress"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@+string/tv_picking_content_ingress"
android:layout_span="2"
android:singleLine="false"
android:layout_weight="1"
/>
</TableRow>
<TableRow>
<TextView android:id="@+id/tvCleaningDot1"
android:layout_height="wrap_content"
android:text="•"
android:singleLine="false"
/>
<TextView android:id="@+id/tvCleaningFirst"
android:layout_height="wrap_content"
android:text="@+string/tv_picking_content_first"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="left"
android:singleLine="false"
/>
</TableRow>
<TextView android:id="@+id/tvCleaningDot2"
android:layout_height="wrap_content"
android:text="•"
android:singleLine="false"
/>
<TextView android:id="@+id/tvCleaningSecond"
android:layout_height="wrap_content"
android:text="@+string/tv_picking_content_second"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="left"
android:singleLine="false"
/>
</TableRow>
</TableLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我用它来在子弹列表中显示静态文本,所以我不打算在代码中动态创建项目符号+文本.如果有人有任何建议如何以更好的方式完成同样的事情,请取悦我.
顺便说一句,如果采用上面第二个链接中建议的解决方案:
android:text="<ol><li>item 1\n</li><li>item 2\n</li></ol>
Run Code Online (Sandbox Code Playgroud)
子弹中跨越多行的第二行,第三行等不会与第一行相同,这非常难看.
谢谢你@Bjorn
你也可以做类似下面的事情.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/point"
android:textAppearance="?android:attr/textAppearanceSmall"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your Text Here"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="14sp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22743 次 |
| 最近记录: |