android - Issues with Coordinator Layout -
i not want toolbar collapse in coordinator layout below. no matter collapses (the tabs not collapse toolbar title does).
second issue nestedscrollview in viewpager has few edittexts. on opening of softkeyboard when edittext @ bottom clicked softkeyboard goes on edittext. on closing softkeyboard , doing second attempt moves edittext text up.
<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:layout_collapsemode="none"> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" app:popuptheme="@style/themeoverlay.appcompat.light" /> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="36dp" android:paddingleft="6dp" app:tabmode="scrollable" /> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="fill_vertical" android:layout_marginbottom="?attr/actionbarsize"/> <android.support.design.widget.floatingactionbutton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:layout_margin="@dimen/fab_margin" android:src="@drawable/ic_add_white_48dp" android:visibility="gone" />
this 1 of views within viewpager:
<android.support.v4.widget.nestedscrollview 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" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginleft="22dp" android:layout_marginright="22dp" android:layout_margintop="15dp" android:orientation="vertical"> <autocompletetextview android:id="@+id/symbolautocompletebuy" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:hint="enter symbol here" android:inputtype="textcapcharacters" /> <textview android:id="@+id/companynamebuy" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="5dp" android:layout_marginleft="4dp" android:textcolor="@color/gray2" android:textstyle="bold" android:textsize="14sp" /> <textview android:id="@+id/currentpricebuy" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="5dp" android:layout_marginleft="4dp" android:textcolor="@color/gray2" android:textstyle="bold" android:textsize="14sp" /> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="20dp" android:orientation="horizontal"> <textview android:layout_weight="0.45" android:layout_width="0dp" android:layout_height="wrap_content" android:text="purchase price"/> <edittext android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.55" /> </linearlayout> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="80dp" android:orientation="horizontal"> <textview android:layout_weight="0.45" android:layout_width="0dp" android:layout_height="wrap_content" android:text="number of shares"/> <edittext android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.55" /> </linearlayout> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margintop="18dp" android:orientation="horizontal"> <textview android:layout_weight="0.45" android:layout_width="0dp" android:layout_height="wrap_content" android:text="purchase date" android:layout_gravity="center_vertical" /> <textview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.35" android:id="@+id/datetext" android:layout_gravity="center_vertical" /> <imageview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.2" android:id="@+id/datepickerimage" android:src="@drawable/ic_event_note_black_24dp" /> </linearlayout> </linearlayout> </android.support.v4.widget.nestedscrollview>
try
<android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" app:contentscrim="@color/primary" app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview android:layout_width="match_parent" android:layout_height="300dp" android:scaletype="centercrop" android:src="@drawable/collapsing_toolbar_bg" app:layout_collapsemode="parallax"/> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:theme="@style/themeoverlay.appcompat.dark.actionbar" app:layout_collapsemode="pin"/> </android.support.design.widget.collapsingtoolbarlayout> <android.support.design.widget.tablayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tab_layout" android:background="?attr/colorprimary"/> </android.support.design.widget.appbarlayout>
the atrribute:
app:layout_scrollflags="scroll|exituntilcollapsed"
prevents collapsing toolbar layout getting collapsed. , replace android:src="@drawable/collapsing_toolbar_bg"
image resource
Comments
Post a Comment