ビューページャーを使用して、折りたたみツールバーを持つ親としてフラグメントとアクティビティ内に NestedScrollview があります。問題は、ネストされたスクロールビューがスクロールして完全な UI を表示しないことです。
テキスト入力レイアウトでエラーが発生した後、ビュー(ボタン)がアクティビティレイアウトを表示すると、次のようになります。
<?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:fitsSystemWindows="true">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
style="@style/overscroll_remove"
android:background="@color/color_white"
android:paddingLeft="@dimen/dimen_editext_padding"
android:paddingRight="@dimen/dimen_editext_padding"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen_collapsing"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:tabMode="fixed"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:tabIndicatorColor="@color/color_00cdb"
app:tabIndicatorHeight="@dimen/dimen_tab_indicator_height"
app:tabSelectedTextColor="@color/color_2323"/>
<include layout="@layout/layout_toolbar"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>
viewpager と scrollivew のスタイル、なし true なし なし
これは、textinputlayout でエラーが表示されるまで、全長までスクロールしなかった NestedScrollview 内のサインアップ画面のレイアウトです。参照用にスクリーンショットを添付し、レイアウトは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/overscroll_remove"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/fs_lay_container"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="@dimen/dimen_layout_margin"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/d_drawable_rectangel_box">
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_fName"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:tag="@string/s_signup_hint_fName"
android:drawableLeft="@drawable/di_user_icon"
android:hint="@string/s_signup_hint_fName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_lName"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:tag="@string/s_signup_hint_lName"
android:drawableLeft="@drawable/di_user_icon"
android:hint="@string/s_signup_hint_lName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_email"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:tag="@string/s_signup_hint_email"
android:drawableLeft="@drawable/di_email"
android:hint="@string/s_signup_hint_email" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<cl.countrycodepicker.CountryCodePicker
android:visibility="gone"
android:id="@+id/fs_tl_ccp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:defaultNameCode="IN" />
<android.support.design.widget.TextInputLayout
style="@style/textInputLayout"
android:id="@+id/fs_tl_countryCode"
android:clickable="true"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:id="@+id/fs_ed_countryCode"
android:drawableLeft="@drawable/di_mobile"
android:clickable="true"
android:tag="@string/s_signup_hint_countryCode"
android:drawableRight="@drawable/di_drop_down"
android:hint="@string/s_signup_hint_countryCode" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_phone"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:tag="@string/s_signup_hint_phone"
android:inputType="number"
android:maxLength="@integer/s_phone_length"
android:drawableLeft="@drawable/di_mobile"
android:hint="@string/s_signup_hint_phone" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_password"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:inputType="textPassword"
android:tag="@string/s_signup_hint_password"
android:drawableLeft="@drawable/di_password"
android:hint="@string/s_signup_hint_password" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_cPassword"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:inputType="textPassword"
android:drawableLeft="@drawable/di_password"
android:hint="@string/s_signup_hint_cPassword" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_address"
style="@style/textInputLayout"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:tag="@string/s_signup_hint_address"
android:id="@+id/fs_ed_address"
android:drawableLeft="@drawable/di_address"
android:hint="@string/s_signup_hint_address" />
</android.support.design.widget.TextInputLayout>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputLayout
android:id="@+id/fs_tl_promo"
android:layout_centerVertical="true"
style="@style/textInputLayout"
android:layout_toLeftOf="@+id/fs_tv_optional"
app:errorTextAppearance="@style/error_appearance"
app:hintTextAppearance="@style/hint_appearance">
<android.support.design.widget.TextInputEditText
style="@style/edittext"
android:imeOptions="actionDone"
android:id="@+id/fs_ed_promo"
android:background="@color/color_tranparent"
android:drawableLeft="@drawable/di_optional"
android:hint="@string/s_signup_hint_rererral" />
</android.support.design.widget.TextInputLayout>
<TextView style="@style/textView"
android:id="@+id/fs_tv_optional"
android:paddingTop="@dimen/dimen_drawable_padding"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:text="@string/s_signup_optional"/>
</RelativeLayout>
</LinearLayout>
<TextView style="@style/textView"
android:layout_below="@+id/fs_lay_container"
android:id="@+id/fs_tv_tCondition"
android:text="@string/s_signup_tCondition"/>
<Button style="@style/button"
android:layout_marginTop="@dimen/dimen_layout_margin"
android:layout_below="@id/fs_tv_tCondition"
android:id="@+id/fs_bt_save"
android:text="@string/s_signup"/>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
TextInput レイアウトのさまざまなスタイルは次のとおりです。
<style name="textInputLayout">
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Subhead</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="error_appearance" parent="TextAppearance.AppCompat.Medium">
<item name="android:textColor">@color/color_red</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Subhead</item>
</style>
<style name="hint_appearance" parent="TextAppearance.AppCompat.Small">
<item name="android:textColor">@color/color_374</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Subhead</item>
</style>
編集テキストのスタイルは次のとおりです。
<style name="edittext" parent="Base.Widget.AppCompat.EditText">
<item name="android:drawablePadding">@dimen/dimen_drawable_padding</item>
<item name="android:singleLine">true</item>
<item name="android:padding">@dimen/dimen_editext_padding</item>
<item name="android:gravity">left</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>