gpt4 book ai didi

Android TextView引用文字部分+竖线

转载 作者:行者123 更新时间:2023-11-29 19:35:34 37 4
gpt4 key购买 nike

我正在寻找在 TextView 中引用部分文本的问题的解决方案。文本很长,有些部分需要引用/突出显示。我用 HTML (Html.fromHtml(String)) 制作了一些东西,但没有这条红色垂直线。你知道如何添加它吗?据我所知,CSS 样式在 TextView 中是不可能的。

enter image description here

最佳答案

Webview with custom line view.

TextView with custom line view.

TextView

enter image description here

网页 View

enter image description here

包装内容

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/base"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="horizontal">


<View
android:layout_width="3dp"
android:layout_height="wrap_content"
android:background="#B1233A"
android:layout_toStartOf="@+id/webView"
android:layout_alignTop="@+id/webView"
android:layout_alignBottom="@+id/webView"
android:layout_marginRight="10dp" />

<WebView
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:id="@+id/webView"></WebView>

<!--<TextView-->
<!--android:layout_width="200dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="My textt from web \nand in multiple \nLines"-->
<!--android:layout_centerHorizontal="true"-->
<!--android:layout_centerVertical="true"-->
<!--android:id="@+id/webView"></TextView>-->

</RelativeLayout>

关于Android TextView引用文字部分+竖线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39248190/

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