android - Nested CardView registration form. How to dynamically size form? -
here picture of current layout
i have been asked create form big square button @ bottom of page.
at point need teach me lesson layouts , me make dynamically sized form. want field cards , text dynamically size , fill screen big blue bar @ bottom. can without orientation qualifiers , stuff?
the design trying meet extends zip code down depending on screensize , stops @ blue bar. while settle anchoring button , using zip code field dynamic filler, ideally have dynamic form. help! p.s. there scrollview somehow use small screens can scroll through fields down button.
<?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:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="@dimen/abc_action_bar_default_height_material" android:fitssystemwindows="true" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar android:id="@+id/toolbar30" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" app:layout_collapsemode="pin" app:popuptheme="@style/themeoverlay.appcompat.light" /> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/submit_button" android:orientation="vertical"> <android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_height="50dp" android:layout_width="match_parent" card_view:cardelevation="5dp" card_view:cardbackgroundcolor="#888888" > </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="match_parent" card_view:cardelevation="5dp" > <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reg_email_hint" android:background="@null" android:layout_margin="20dp" > </edittext> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="match_parent" card_view:cardelevation="5dp" android:layout_margintop="1dp" > <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reg_firstname_hint" android:background="@null" android:layout_margin="20dp"> </edittext> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="match_parent" card_view:cardelevation="5dp" android:layout_margintop="1dp" > <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reg_lastname_hint" android:background="@null" android:layout_margin="20dp"> </edittext> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="match_parent" card_view:cardelevation="5dp" android:layout_margintop="1dp" > <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reg_password_hint" android:background="@null" android:layout_margin="20dp"> </edittext> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="match_parent" card_view:cardelevation="5dp" android:layout_margintop="1dp" > <edittext android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/reg_confirmpassword_hint" android:background="@null" android:layout_margin="20dp"> </edittext> </android.support.v7.widget.cardview> <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="match_parent" card_view:cardelevation="5dp" android:layout_margintop="1dp" > <edittext android:layout_width="match_parent" android:layout_height="fill_parent" android:hint="@string/reg_zipcode_hint" android:background="@null" android:layout_margin="20dp" > </edittext> </android.support.v7.widget.cardview> <view android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <button android:id="@+id/submit_button" android:layout_width="match_parent" android:layout_height="100dp" android:layout_gravity="bottom" android:background="#21c064" android:textcolor="#ffffff" android:textsize="20sp" android:text="save" /> </linearlayout> </android.support.design.widget.appbarlayout> </scrollview>
try this
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/submit_button" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:padding="8dp" android:text="form field" android:textsize="20sp" /> <view android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <button android:id="@+id/submit_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:text="@string/hello_world" /> </linearlayout> </scrollview>
trick here give scrollview android:fillviewport="true" scrollview child full height scrollview if content small add empty view between last form element , submit button this
<view android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" />
so fill maximum available space
Comments
Post a Comment