直升机,
我正在为一个网站开发app.我有折叠工具栏和嵌套ScrollView的问题.
当您第一次打开文章时,它看起来像这样(http://imgur.com/UpIJa59).向下滚动文本和图像之间的空白后删除.
以下是此活动的布局:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".main.ArticleToolbar">
<android.support.design.widget.AppBarLayout
android:layout_height="192dp"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/appbar_article">
<android.support.design.widget.CollapsingToolbarLayout
android:fitsSystemWindows="true"
android:id="@+id/collapsing_toolbar"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="4dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:id="@+id/head_image"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/article_header"
android:textSize="23sp"
android:gravity="bottom" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:layout_height="?attr/actionBarSize"
android:id="@+id/toolbar_article"
android:layout_width="match_parent"
app:popupTheme="@style/AppTheme"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/container_article"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/appbar_article"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
Run Code Online (Sandbox Code Playgroud)
你能提出什么建议?谢谢.
在我的应用程序中,我获取并解析 html 内容并使用 Spanned 显示它。我这样使用 Spanned:
String html = "<p>Html Content</p>"
Spanned htmlSpan = Html.fromHtml(html, imageParser, null);
Run Code Online (Sandbox Code Playgroud)
我尝试使用 apache commons 库来设置填充,但它不起作用。
有什么办法可以设置左右padding吗?
编辑:忘了提及,我的 html 内容中也有图像。我尝试向 TextView 本身添加填充,但这样,所有图像也都有填充。