<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_overviewtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Overview: "
android:textStyle="bold"
android:lines="1"/>
<TextView
android:id="@+id/tv_overview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Underworld: Blood Wars follows
Vampire death dealer, Selene, as she fends
off brutal attacks from both the Lycan clan
and the Vampire faction that betrayed her.
With her only allies,David and his father
Thomas, she must stop the eternal war between
Lycans and Vampires, even if it means she has to
make the ultimate sacrifice."
android:layout_alignBottom="@+id/tv_overviewtitle"
android:layout_alignParentRight="true"/>
</LinearLayout>
我有两个TextView,如下所示:
在下一行中,我希望"Selene, as she fends....."
从行的开头开始。从概述的“O”下方。我该怎么办?
答案 0 :(得分:0)
如果我理解正确的话,你的文字会像
那样<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<div class="container">
<ul id="suggestion_list">
<li class="mp_search_suggest_element">
<span><b>some bold text</b> hedfreaf asf sasdasdasf asdf f adsf asdf sdf sdf</span><i class="fa fa-bed" aria-hidden="true"></i>
</li>
<li class="mp_search_suggest_element">
<span><b>some bold text</b> here</span><i class="fa fa-bed" aria-hidden="true"></i>
</li>
</ul>
</div>
所以,你有几种方法。第一个出现在我脑海中的是:
Overview MyFirstText written
on more rows but
always alligned
like this
MySecondText which is written
this way, so aligned like the
Overview text and fullscreen
我没有任何编译器就写了它,所以如果有任何问题请告诉我,我会修复
希望这会有所帮助
所以,只需做一件不同的事情:
在Java端,将您的<!-- this layout will contain the full text -->
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
>
<!-- this layout will contain overview and the first text -->
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="@+id/tv_overviewtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Overview: "
android:textStyle="bold"
android:lines="1"/>
<TextView
android:id="@+id/tv_overview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Underworld: Blood Wars follows Vampire death dealer, scelene, as she fends off brutal attacks from both the Lycan clan and the Vampire faction that betrayed her. With her only allies, David and his father Thomas, she must stop the eternal war between Lycans and Vampires, even if it means she has to make the ultimate sacrifice."
/>
</LinearLayout>
<TextView
android:id="@+id/tv_secondText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Selene, as she fends....."
/>
</LinearLayout>
。
textView
现在,对所有文字使用单一文本视图
在String.xml文件中设置如下全文:
TextView myFullText = (TextView)findViewById(R.id.tv_overview);
如您所见,我在html中添加了<b>Overview:</b> Blood Wars follows Vampire death dealer, scelene, as she fends off brutal attacks from both the Lycan clan and the Vampire faction that betrayed her. With her only allies, David and his father Thomas, she must stop the eternal war between Lycans and Vampires, even if it means she has to make the ultimate sacrifice.
符号<b>
。
现在设置文字:
bold
这将有效
答案 1 :(得分:0)
您可以使用单个textview并使用html标记格式化文本,如下所示:
TextView myTextView= (TextView) findViewById(R.id.textView3);
myTextView.setText(Html.fromHtml("<b>Lorem</b> ipsum dolor sit amet, consectetur adipiscing elit. Donec risus tellus, gravida bibendum mi vitae, bibendum..."));