Android 如何更好地显示我的内容?
这是我的内容的当前格式 项目符号从下一段的同一行开始。 现在我想实现这样的目标 我想让这一段从离子弹不远的地方开始。我怎样才能做到这一点 这是我的xmlAndroid 如何更好地显示我的内容?,android,xml,android-layout,listview,Android,Xml,Android Layout,Listview,这是我的内容的当前格式 项目符号从下一段的同一行开始。 现在我想实现这样的目标 我想让这一段从离子弹不远的地方开始。我怎样才能做到这一点 这是我的xml <me.biubiubiu.justifytext.library.JustifyTextView android:textColor="@color/black" android:paddingTop="2dp" android:id="@+id/practic
<me.biubiubiu.justifytext.library.JustifyTextView
android:textColor="@color/black"
android:paddingTop="2dp"
android:id="@+id/practices"
android:layout_below="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp" />
在
项目符号之后
在字符串中添加两个空格字符
,您可以使用
String
中的replaceAll
与中的相同
String bulletCode = "#8226";
String spaceCode = " ";
myContent.replaceAll(bulletCode, bulletCode+spaceCode+spaceCode);
我用这个方法得到了要点,你可以试试这个
String BULLET_SYMBOL = "•";
private String text = Html.fromHtml(BULLET_SYMBOL + " +1 new goat every 12 months for 36 months")
+ System.getProperty("line.separator")
+ System.getProperty("line.separator")
+ Html.fromHtml(BULLET_SYMBOL + " 10-30% estimated ROI")
+ System.getProperty("line.separator")
+ System.getProperty("line.separator")
+ Html.fromHtml(BULLET_SYMBOL + " New animal if dead or infertile");
JustifyTextView practices = (JustifyTextView)findViewById(R.id.practices);
practices.setText(text);
System.getProperty(“line.separator”)用于新行,用于显示带有项目符号的排版,您需要使用适当的正则表达式,以便根据需要缩进它 例如,您可以使用以下选项:
\u2022\s\d\. \s[A-z]
这将有助于你实现预期目标 你可以使用Webview小部件,它可以根据你的需要格式化数据,也可以使用html代码的功能。让我试试看,我已经试过了。空格字符添加得很好,但是下一行仍然与项目符号在同一级别开始