gpt4 book ai didi

android - 为什么在 TextView android 中加载 html
内容时左边缘显示蓝色垂直线

转载 作者:行者123 更新时间:2023-11-28 02:15:12 25 4
gpt4 key购买 nike

我有一个应用程序,其中我在 TextView 中显示了一些 html 内容。所以当 textView 呈现所有 html 内容时,它会显示这个。

经过一些搜索,我发现 blockquote 导致了这个问题。我想在 block 引用文本中设置 block 引用内容的样式,例如 p 标签。

here is the image

我想删除/设计 TextView 左边缘 Angular 的蓝色垂直线。

我尝试获取文章的描述,这里是 html 内容。

 <p>Razorpay, an online payments solution provider, has announced that it has raised $20 million in its Series B funding round. The round was led by Silicon Valley-based accelerator Y Combinator’s YC Continuity Fund and existing investor Tigers Global. Along with them, Matrix Partners has also participated in this round.</p>
<p>The Bangalore-based startup now plans to use the freshly raised funds to push new products which it launched in September last year including facilities like recurring payments, automation of bank transfers like NEFT, and invoice management as part of its new strategy under Razorpay 2.0.</p>
<p>Harshil Mathur, co-founder and CEO of the company, said:</p>
<blockquote><p>We are looking to expand our team and hire heads for new business verticals. About 50% of new hires will be in technology and the product teams while the rest would be for business roles.</p></blockquote>
<p>Anu Hariharan, Partner at Y Combinator’s Continuity Fund said,</p>
<blockquote><p>We are excited to participate in Razorpay’s Series B round. The company’s vision and execution over the last 3 years has shown tremendous results, especially for an India focused SAAS company. With the online and digital payment space going through a massive transformation in India, their business is only going to grow further. There is now an inherent need for better systems, process and infrastructure in place and we are confident that Razorpay is perfectly suited to make the most of the changing landscape.</p></blockquote>
<p>At present, it has about 130 people and it could hire over 70 people during this year. Mathur said the company, as part of the new strategy, is looking to generate at least 30% of company’s revenue from these new launches.</p>
<p>The latest round takes the total amount the startup has raised to $31.6 million The company last raised undisclosed funding from American payments and financial services company MasterCard, in July 2016. At the same time, the startup also became the second Indian company to be selected for the US-based Y-Combinator accelerator programme.</p>
<p>Founded in 2013 by Harshil Mathur and Shashank Kumar, Razorpay aims to onboard new merchants and increase the base to about 2 lakh by the end of 2018. It claimed to have grown at a rate of about 30-35% per month and has about 65,000 merchants on its platform.</p>
<p>Razorpay has been backed by 33 angel investors, including Kunal Bahl and Rohit Bansal (Snapdeal founders); Abhay Singhal, Amit Gupta and Naveen Tewari (InMobi founders), Kunal Shah and Sandeep Tandon (Freecharge founders), former chief product officer of Flipkart Punit Soni, Ram Shriram (board member and an early investor in Google), Justin Kan (Y Combinator partner and Twitch founder).</p>

这是 xml 布局代码。

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/post_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<Button
android:id="@+id/share_postBtn"
android:layout_margin="@dimen/fab_margin"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:foreground="?attr/selectableItemBackground"
android:background="@drawable/ic_share"
android:backgroundTint="#fff"
android:onClick="SharePost"/>

<Button
android:id="@+id/save_postBtn"
android:layout_margin="@dimen/fab_margin"
android:layout_width="25dp"
android:layout_height="match_parent"

android:layout_toStartOf="@+id/share_postBtn"
android:foreground="?attr/selectableItemBackground"
android:backgroundTint="#fff"
android:onClick="SavePost"/>

<Button
android:id="@+id/minus_tvsize"
android:layout_margin="@dimen/fab_margin"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_toStartOf="@+id/save_postBtn"
android:foreground="?attr/selectableItemBackground"
android:background="@drawable/ic_minus"
android:backgroundTint="#fff"/>
<Button
android:id="@+id/plus_tvsize"
android:layout_margin="@dimen/fab_margin"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_toStartOf="@+id/minus_tvsize"
android:foreground="?attr/selectableItemBackground"
android:background="@drawable/ic_plus"
android:backgroundTint="#fff"/>

</RelativeLayout>
</android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
android:id="@+id/post_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- do not remove below layout -->
<LinearLayout
android:id="@+id/viewA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_purple"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/txtDetailTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/firasans_bold"
android:lines="4"
android:textStyle="bold"
style="@style/TextAppearance.AppCompat.Headline"
android:layout_marginTop="@dimen/appbar_padding_top"
android:layout_marginEnd="@dimen/appbar_padding_top"
android:layout_marginBottom="@dimen/appbar_padding_top"
android:layout_gravity="start"/>

<ImageView
android:id="@+id/postFeatImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true" />




<TextView
android:id="@+id/txtDetailDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/firasans_regular"
android:layout_gravity="fill"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:ellipsize="marquee"
android:lineSpacingExtra="@dimen/_3ssp"
android:paddingEnd="@dimen/appbar_padding_top"
android:paddingStart="@dimen/appbar_padding_top"
android:textSize="@dimen/_15ssp" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_topScroll"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_margin="16dp"
android:src="@drawable/ic_keyboard_arrow_up"
android:scaleType="center"
android:tint="#fff"
android:layout_gravity="bottom|end"
android:onClick="ScrollTop"/>
</android.support.design.widget.CoordinatorLayout>

我在 textview 上加载文章描述,它有 txtDetailDescription id

最佳答案

这是load html的好方法

并在 TextView 中加载 html,您可能会这样使用

 if (Build.VERSION.SDK_INT >= 24) {
txtDetailDescription.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>", Html.FROM_HTML_MODE_COMPACT));
} else {
txtDetailDescription.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
}

关于android - 为什么在 TextView android 中加载 html <blockquote> 内容时左边缘显示蓝色垂直线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48516164/

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