たとえば、LinearLayout内に500dpと150dpのTextViewが必要です。ScrollView内で中間の塗りつぶしの高さを維持する方法(存在する場合)
大画面:
とNOが存在する場合、任意の残りの高さ(:大画面デバイスで例えば)がある場合は応答レイアウトのため、その中央に、赤の領域が存在することになりますスペース(例:小さな画面のデバイスで)残っている:
スモールスクリーン:
、赤いエリアとスクロール可能になっビューはないだろう私が試した:
activity_main.xml layout_weightを設定
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:background="#FFFFAA"
android:layout_width="match_parent"
android:layout_height="500dp"
android:text="500dp"
android:gravity="center_vertical"
android:textAlignment="center" />
<View
android:background="#FF0000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:background="#AAFF"
android:layout_width="match_parent"
android:layout_height="150dp"
android:text="150dp"
android:gravity="center_vertical"
android:textAlignment="center" />
</LinearLayout>
</ScrollView>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
= "1" 赤領域が、大画面での残りの高さを満たさない赤色領域について:
大画面:
私はそれをどのように行うことができますか?