Давайте начнем со скриншотами я должен подготовиться к этому вопросуScrollView с целью высоты match_parent внутри
в этой схеме, не может быть, большой баннер был существует, так что скрыть, как вы видите, в другой фотография. часть этого макета содержит текст, поэтому я хочу прокрутить содержимое отверстия вместе, но хочу, чтобы высота фона под текстом заполняла мой экран и не влияла на свиток, поэтому прокрутка должна быть активной, если текст слишком длинный или высота баннера была больше.
это мой макет коды:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".NewsActivity"
tools:showIn="@layout/activity_news">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/bigPicture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:scaleType="fitXY"
android:src="@drawable/tama_logo" />
<RelativeLayout
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/largeIcon"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="false"
android:layout_alignWithParentIfMissing="false"
android:src="@mipmap/ic_launcher"
android:layout_marginTop="8dp"
android:layout_marginRight="12dp"
android:layout_marginLeft="8dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"
android:background="@drawable/shadow"
android:id="@+id/messageBody"
android:layout_toStartOf="@+id/largeIcon"
android:layout_toLeftOf="@+id/largeIcon">
<TextView
android:id="@+id/title"
style="@style/news_activity_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2" />
<TextView
android:id="@+id/body"
style="@style/news_activity_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/date"
android:layout_alignWithParentIfMissing="true"
android:maxLines="3"
android:text="1369/12/25 22:45:32"
android:textColor="#aaa"
android:textSize="10sp"
android:singleLine="false"
android:gravity="center_horizontal"
android:textStyle="bold"
android:layout_below="@+id/largeIcon"
android:layout_toRightOf="@+id/messageBody"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
эта картина будет explane то, что я ожидал, извините за мой плохой английский :(
Сверху моей головы вы пытались установить ScrollView вместо RelativeLayout для fillViewport = "true" и установить RelativeLayout на высоту "match_parent" вместо "wrap_content"? Возможно, я не понимаю, какое представление вы пытаетесь изменить. –
@ChadSchultz Я использую fillViewport = "true" в scrollview и устанавливаю RelativeLayout в height "match_parent, но все тот же результат. Мне нужно, чтобы relativelayout, заполнить parrent по вертикали, но не влиять на прокрутке – Omid
@ChadSchultz я могу использовать framelayout под scrollview и установить ширину этого как ширину моего realativelayout программно? Это нормально? – Omid