Please have a look at the below UI (please ignore the comment in red)
Below is my attempt in making it
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/content_id_target_ranges"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".activities.TargetRangesActivity"
tools:showIn="#layout/app_bar_target_ranges">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_title_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="12dp"
android:text="#string/my_settings_target_ranges"
android:textSize="20sp" />
<TextView
android:id="#+id/target_ranges_sub_heading_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:text="#string/target_ranges_sub_heading"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="12dp"
android:background="#drawable/linear_border"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_blood_glucose_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="12dp"
android:text="#string/target_ranges_blood_glucose_text"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="15dp"
android:layout_marginTop="6dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_blood_glucose_pre_meal_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/target_ranges_blood_glucose_pre_meal"
android:textAlignment="center"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/target_ranges_blood_glucose_pre_meal_unit_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:text="#string/target_ranges_blood_glucose_unit"
android:textAlignment="center"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_first_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_second_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_third_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="34dp"
android:layout_height="48dp"
android:textSize="16sp"
android:textColor="#color/colorWhite"
android:background="#drawable/gray_colour_style"
android:layout_weight="1.46" />
<TextView
android:layout_width="90dp"
android:layout_height="48dp"
android:textSize="16sp"
android:background="#drawable/green_colour_style"
android:textColor="#color/colorWhite"
android:layout_weight="0.15" />
<TextView
android:layout_width="60dp"
android:layout_height="48dp"
android:textSize="16sp"
android:background="#drawable/yellow_colour_style"
android:textColor="#color/colorWhite" />
<TextView
android:layout_width="70dp"
android:layout_height="48dp"
android:textSize="16sp"
android:background="#drawable/red_colour_style"
android:textColor="#color/colorWhite"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="12dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="#+id/target_ranges_blood_glucose_post_meal_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/target_ranges_blood_glucose_post_meal"
android:textAlignment="center"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/target_ranges_blood_glucose_post_meal_unit_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:text="#string/target_ranges_blood_glucose_unit"
android:textAlignment="center"
android:textSize="10sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_four_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_five_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="6dp"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#drawable/edit_text_style">
<EditText
android:id="#+id/target_ranges_blood_glucose_six_edit"
style="#style/EditTextStyle"
android:focusable="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="24dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
However it generated the below UI
Notice how the colorfull bar is not aligned properly with the upper and lower text boxes, as the first image indicated via a dotted line (the dotted line shows the where the edge of each colourful tile should be, in aligned with the textboxes.
Also notice my text boxes are different than what is expected.
How can I make it as displayed in the first image?
Here I have fix your inner layout, change drawable and color.., etc
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/content_id_target_ranges"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/down_shadow"
android:orientation="vertical"
android:weightSum="20">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Texttttttttttttttttttttttttttttttttt"
android:textColor="#000" />
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:weightSum="10">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:id="#+id/pre_meal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="kkk lkjl" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/pre_meal"
android:gravity="center"
android:text="sd/sd" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8"
android:orientation="horizontal"
android:weightSum="6">
<EditText
android:id="#+id/one"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/two"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/three"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal"
android:weightSum="9">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1.5"
android:background="#8c9393"
android:gravity="center"
android:text="Low"
android:textColor="#fff" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="2.4"
android:background="#1dea12"
android:gravity="center"
android:text="Normal"
android:textColor="#fff" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="2.2"
android:background="#f5d904"
android:gravity="center"
android:text="High"
android:textColor="#fff" />
<TextView
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1.9"
android:background="#ea0c05"
android:gravity="center"
android:layout_marginRight="2dp"
android:text="Very High"
android:textColor="#fff" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:weightSum="10">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:id="#+id/pre_meals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="kkk lkjl" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/pre_meals"
android:gravity="center"
android:text="sd/sd" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8"
android:orientation="horizontal"
android:weightSum="6">
<EditText
android:id="#+id/four"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/five"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<EditText
android:id="#+id/six"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:background="#999698"
android:focusable="true" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Instead of Edittext use your TextInput layout. It is giving error while compiling so i changed it to Edittext
Related
I have one fragment whose layout i want to show above keyboard when softkeyboard opens up. The layout is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:animateLayoutChanges="true"
android:background="#drawable/ic_bg_splash"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/previous"
android:layout_width="37.5dp"
android:layout_height="37.5dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="22dp"
android:background="#drawable/left"
android:padding="7dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="7dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="7dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="7dp"
android:orientation="vertical">
<ImageView
android:id="#+id/subCat"
android:layout_width="157.5dp"
android:layout_height="157.5dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="50dp"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/nunito"
android:paddingLeft="20dp"
android:text="#string/enter_answer"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
<LinearLayout
android:layout_width="262.5dp"
android:layout_height="52.5dp"
android:layout_marginTop="7dp"
android:background="#drawable/answer_bg"
android:orientation="horizontal">
<EditText
android:id="#+id/answer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="8"
android:background="#null"
android:fontFamily="#font/nunito"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:padding="7dp"
android:textColor="#android:color/white"
android:textSize="15sp" />
<ImageView
android:id="#+id/wrong_answer"
android:layout_width="27.5dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="#drawable/red_cross"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:layout_marginBottom="27dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/nunito"
android:text="#string/reset"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="14.3sp" />
<TextView
android:id="#+id/submit_ans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:background="#drawable/white_rounded"
android:fontFamily="#font/nunito_semibold"
android:paddingLeft="17dp"
android:paddingTop="7dp"
android:paddingRight="17dp"
android:paddingBottom="7dp"
android:text="#string/submit"
android:textAllCaps="true"
android:textColor="#color/lineColor"
android:textSize="14.3sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/next"
android:layout_width="37.5dp"
android:layout_height="37.5dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="22dp"
android:background="#drawable/right" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/write_dark"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#70000000"
android:elevation="10dp"
android:visibility="gone">
<ImageView
android:id="#+id/write_success"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I have tried by setting windowssoftinputmode to adjustResize in manifest and also using fitsystemwindows to true in the fragment parent layout but still it is not working and using scrollview as parent layout instead of relativelayout. So please suggest me any workaround for this issue.
Edit: Added below activity.xml layout:
Below is the host activity layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="#drawable/language_bg"
android:orientation="vertical"
tools:context=".home.HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bottom_rounded">
<RelativeLayout
android:id="#+id/taskBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
android:layout_weight="1.7"
android:paddingLeft="30dp"
android:paddingTop="5dp">
<ImageView
android:layout_width="143dp"
android:layout_height="56dp"
android:layout_gravity="left|center_vertical"
android:src="#drawable/hello_logo" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_weight="3"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/learn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="33dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#drawable/learn_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/learn"
android:textColor="#color/lineColor"
android:textSize="11sp" />
<View
android:id="#+id/learn_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#color/lineColor" />
</LinearLayout>
<LinearLayout
android:id="#+id/practice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="42dp"
android:layout_height="28dp"
android:src="#drawable/practice_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/practice"
android:textColor="#color/lineColor"
android:textSize="11sp" />
<View
android:id="#+id/practice_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#color/lineColor"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginRight="30dp"
android:layout_weight="1.3"
android:gravity="right"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="26.5dp"
android:layout_height="32dp"
android:src="#drawable/unlock_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/unlock"
android:textColor="#color/lineColor"
android:textSize="11dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/language"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:gravity="center_horizontal|bottom"
android:orientation="vertical">
<ImageView
android:layout_width="33dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="#drawable/language" />
<TextView
android:id="#+id/language_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="#string/lang"
android:textAllCaps="true"
android:textColor="#color/lineColor"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/appbar_practice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="12dp"
android:visibility="gone">
<LinearLayout
android:id="#+id/read_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="23.5dp"
android:layout_height="17.5dp"
android:background="#drawable/icon_read" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/read"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/read_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/speak_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="16.5dp"
android:layout_height="21.5dp"
android:background="#drawable/icon_speak" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/speak"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/speak_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/listen_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="18.5dp"
android:layout_height="18.5dp"
android:background="#drawable/icon_listen" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/listen"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/listen_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/write_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="19dp"
android:background="#drawable/icon_write" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/write"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/write_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Try to put your scrollView into relative Layout.
After commenting this from my activity onCreate() it started working:
this.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
This is how it looks like Hii i want to make this screen scrollable there are certain tables i have created using linear layout but i have tried everything but cant find any solution.I used frame layout inside their is an linear layout so while running this on small screen it gets hide.I have tried add scroll view but its didnt work please help me to fix it out.
**<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="#android:color/white"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="100dp"
android:background="#drawable/ic_down"
android:orientation="vertical"
android:weightSum="8.8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textColor="#android:color/black"
android:textSize="14dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Quantity"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hour Multiplier"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Shramanand Hours"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Courses/Camps"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" x 10"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="1 Day Test including Machine Test"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:hint="__"
android:paddingLeft="8dp"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 6"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Manashakti Varganidar"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 5"
android:textColor="#android:color/black"
android:textSize="16dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="right|bottom"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:background="#drawable/rounded_corner_button_bg"
android:text="Next" />
</LinearLayout>
</FrameLayout>
</LinearLayout>**
Add Scroll View with android:fillViewport="true" Attribute in Layout
And also add in menifest to resolve edittext shrink issue
<activity android:name=".MainActivity"
android:windowSoftInputMode="adjustPan"/>
Try This Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="#android:color/white"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
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_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="100dp"
android:orientation="vertical"
android:weightSum="8.8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textColor="#android:color/black"
android:textSize="14dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Quantity"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Hour Multiplier"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Shramanand Hours"
android:textColor="#android:color/black"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Courses/Camps"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" x 10"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="1 Day Test including Machine Test"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:hint="__"
android:paddingLeft="8dp"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 6"
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="horizontal"
android:weightSum="4">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.6"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Manashakti Varganidar"
android:textColor="#android:color/black"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".8"
android:gravity="center">
<EditText
android:id="#+id/edtCount3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLength="3"
android:paddingLeft="8dp"
android:hint="__"
android:textColor="#android:color/black"
android:textCursorDrawable="#null"
android:textSize="15sp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".9"
android:gravity="center">
<TextView
android:id="#+id/txtHours3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="x 5"
android:textColor="#android:color/black"
android:textSize="16dp" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight=".7"
android:gravity="center">
<TextView
android:id="#+id/txtTotalHours3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textColor="#android:color/black"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="right|bottom"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
android:text="Next" />
</LinearLayout>
</ScrollView>
</FrameLayout>
Check text not null
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String text1=edtCount1.getText().toString();
String text2=edtCount2.getText().toString();
String text3=edtCount3.getText().toString();
if(!isNullOrEmpty(text1)||!isNullOrEmpty(text2)||!isNullOrEmpty(text3)){
//Add your executable code here
}else {
Toast.makeText(MainActivity.this, "Please Add All Data", Toast.LENGTH_SHORT).show();
}
}
});
}
public boolean isNullOrEmpty(String str){
return str==null || str.isEmpty();
}
I am working on android app
and i have cart activity which have multi row of products
and then the total of cart and button to continue..
This layout have top and buttom bars and then Scrollview have linearLayout as child...
This child contain:
Recyclerview
Textboxes
Button
My problem is: I cant scroll to the last item in my layout (The Button) .
This is my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:layout_alignParentTop="true">
<ImageView
android:id="#+id/ProgressBar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="#drawable/progress_rec"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/overview_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/backgroudn"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/tt"
>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "70dp"
android:elevation="12dp"
android:padding="8dp"
android:background="#drawable/white_action_bar"
android:id="#+id/first"
android:orientation="horizontal"
android:weightSum="1">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:elevation="12dp"
android:id="#+id/btnActionBar11"
android:drawableStart="#drawable/ic_arrow_back_black_24dp"
android:drawableLeft="#drawable/ic_arrow_back_black_24dp"
android:drawablePadding="8dp"
android:drawableTint="#color/colorPrimaryDark"
android:padding="8dp"
android:background="#android:color/transparent"
android:layout_weight="0.2" />
<TextView
android:layout_width = "0dp"
android:layout_height = "wrap_content"
android:gravity="center"
android:textSize="14sp"
android:padding="8dp"
android:text="#string/cart"
android:layout_marginTop="8dp"
android:id="#+id/tvActionBar"
android:textColor="#color/colorPrimaryDark"
android:layout_weight="0.5"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:id="#+id/btnActionBarEnd11"
android:padding="8dp"
android:drawableEnd="#drawable/ic_shopping_cart_black_24dp"
android:drawableRight="#drawable/ic_shopping_cart_black_24dp"
android:drawablePadding="8dp"
android:drawableTint="#color/colorPrimaryDark"
android:textColor="#color/colorPrimaryDark"
android:background="#android:color/transparent"
android:layout_weight="0.3"
android:textSize="12sp"
android:visibility="gone"/>
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_below="#+id/first">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/no_data"
android:text="#string/no_data"
android:textSize="24sp"
android:textAlignment="center"
android:gravity="center"
android:textColor="#color/colorPrimary"
android:visibility="gone"/>
<ProgressBar
android:foregroundGravity="center"
android:id="#+id/progress"
android:layout_below="#+id/no_data"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#android:color/transparent"
android:layout_gravity="center"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cartContentList"
android:layoutAnimation="#anim/layout_animation"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"
android:weightSum="1"
android:id="#+id/totalLayout">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:text="#string/total"
android:textSize="#dimen/medium"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:text="#string/zero_dollar"
android:textSize="#dimen/medium"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
android:id="#+id/tvTotal"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/round_button"
android:text="#string/continue_"
android:textColor="#color/white"
android:textSize="#dimen/medium"
android:layout_margin="8dp"
android:padding="8dp"
android:gravity="center"
android:id="#+id/btnContinue" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="8dp"
android:paddingTop="8dp"
android:id="#+id/any"
android:background="#drawable/white_menu_bar"
android:layout_alignParentBottom="true"
android:elevation="24dp">
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "40dp"
android:elevation="12dp"
android:padding="2dp"
android:id="#+id/end"
android:orientation="horizontal"
android:weightSum="1"
android:gravity="center_horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:drawableTop="#drawable/home_1"
android:layout_margin="8dp"
android:gravity="center"
android:layout_gravity="center"
android:textColor="#color/colorPrimaryDark"
android:paddingEnd="15dp"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
android:layout_gravity="center"
android:id="#+id/btnMyOrder"
android:drawableTop="#drawable/my_orders_1"
android:layout_margin="8dp"
android:paddingEnd="15dp"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:textColor="#color/colorPrimaryDark"
android:gravity="center"
android:layout_gravity="center"
android:drawableTop="#drawable/notifications_1"
android:layout_margin="8dp"
android:paddingEnd="18dp"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:background="#android:color/transparent"
android:drawableTop="#drawable/side_menu_1"
android:layout_marginTop="8dp"
android:drawableTint="#color/colorPrimaryDark"
android:layout_gravity="center"
android:paddingEnd="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "20dp"
android:elevation="12dp"
android:id="#+id/end1"
android:orientation="horizontal"
android:weightSum="1"
android:gravity="center_horizontal">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr1Home1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:paddingTop="8dp"
android:drawablePadding="15dp"
android:visibility="visible"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr2Notification1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:padding="8dp"
android:drawablePadding="15dp"
android:visibility="invisible"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr3Message1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:padding="8dp"
android:drawablePadding="15dp"
android:visibility="invisible"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:id="#+id/gr4Calender1"
android:drawableTop="#drawable/component1"
android:background="#android:color/transparent"
android:layout_weight="0.25"
android:padding="8dp"
android:drawablePadding="15dp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
.
This is my Cart Activity XMl:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="#color/cart_bg"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/cart_bg"
android:orientation="vertical">
<include
android:id="#+id/abl_main1"
layout="#layout/app_header_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<LinearLayout
android:id="#+id/ll_item_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/abl_main1"
android:orientation="horizontal">
<TextView
android:id="#+id/tv_item_count_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/montserrat"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingBottom="10dp"
android:text="#string/my_cart"
android:textColor="#color/text_item"
android:textSize="#dimen/text_size_18"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_item_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/montserrat"
android:paddingLeft="0dp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingBottom="10dp"
android:text="#string/my_cart"
android:textColor="#color/gray_9E"
android:textSize="#dimen/text_size_12"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_total"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:padding="10dp"
android:text="#string/total_caps"
android:textColor="#color/text_item"
android:textStyle="bold"
android:visibility="gone" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ll_item_count">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="60dp"
android:visibility="visible">
<LinearLayout
android:id="#+id/ll_listing"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="visible">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rcv_cart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:background="#android:color/transparent"
android:clipToPadding="false"
android:orientation="vertical"
android:visibility="visible"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<androidx.cardview.widget.CardView
style="#style/CardView.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="#color/white"
app:cardCornerRadius="4dp">
<LinearLayout
android:id="#+id/ll_playable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/cart_total"
android:textColor="#color/text_item"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_cart_total"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/total"
android:textColor="#color/text_item"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_sub_total"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/discount"
android:textColor="#color/text_item"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_discount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/dilivery"
android:textColor="#color/text_item"
android:textStyle="normal" />
<TextView
android:id="#+id/tv_delivery"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:text="#string/total_payable"
android:textColor="#color/text_item"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_total_payable"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:fontFamily="#font/montserrat"
android:gravity="right"
android:text=""
android:textColor="#color/text_item"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/montserrat"
android:maxLines="2"
android:text="#string/tax_and_shipping_calculated"
android:textColor="#color/text_item"
android:textSize="#dimen/text_size_15"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:paddingTop="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin5dp"
android:fontFamily="#font/montserrat"
android:text="#string/add_order_note"
android:textColor="#color/text_item" />
<EditText
android:id="#+id/ed_order_note"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/shape_rectangle_transperant_bg_app_color_border"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="top|left"
android:hint="#string/how_can_we_help_you"
android:imeOptions="actionDone"
android:isScrollContainer="false"
android:lines="3"
android:maxLines="3"
android:overScrollMode="always"
android:padding="#dimen/margin5dp"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:textColor="#color/text_item" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rr_empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/ll_item_count"
android:layout_centerInParent="true"
android:background="#color/white"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:id="#+id/ll_backgorund_circle_cart"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:background="#drawable/circle_drawable"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/iv_background_icon_cart"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:src="#mipmap/iv_red_heart"
android:visibility="visible" />
</LinearLayout>
<TextView
android:id="#+id/tv_empty_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_10"
android:layout_marginTop="#dimen/text_size_20"
android:layout_marginRight="#dimen/padding_10"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:text="#string/your_bag_is_empty"
android:textColor="#color/text_item"
android:textSize="20dp"
android:textStyle="bold"
android:visibility="visible" />
<TextView
android:id="#+id/tv_empty_sub_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_10"
android:layout_marginTop="#dimen/padding_10"
android:layout_marginRight="#dimen/padding_10"
android:layout_marginBottom="30dp"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:text="#string/item_added_to_bag"
android:textColor="#color/gray_9E"
android:textSize="16dp"
android:textStyle="normal"
android:visibility="visible" />
<LinearLayout
android:id="#+id/ll_shopping_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/shape_rectangle_transperant_bg_app_color_border_new"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="#+id/tv_shopping_now"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/input_layout_password"
android:layout_alignParentStart="true"
android:layout_gravity="center_horizontal"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:padding="#dimen/padding_10"
android:text="#string/shopping_now"
android:textColor="#color/black"
android:textSize="16dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<View
android:id="#+id/v_order_place"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="#+id/ll_place_order"
android:background="#color/light_gray" />
<LinearLayout
android:id="#+id/ll_place_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/white"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".5"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="#+id/tv_place_order_total"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:text=""
android:textColor="#color/text_item"
android:textStyle="bold" />
</LinearLayout>
<com.wpa3.productshopify.util.RippleView
rv_centered="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".5"
app:rv_type="rectangle"
app:rv_zoom="true">
<TextView
android:id="#+id/tv_place_order"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:layout_weight=".5"
android:background="#drawable/shape_round_corner_rectangle"
android:fontFamily="#font/montserrat"
android:gravity="center"
android:padding="10dp"
android:text="#string/place_order"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="15sp" />
</com.wpa3.productshopify.util.RippleView>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Right now i'm busy so did not seen your XML but check my code snippet.
Hope this may help you
This is my xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="testFun:"
android:textColor="#color/text_black"
android:textSize="#dimen/titleTextSize"
android:textStyle="bold" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray" />
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/testLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="test" />
</LinearLayout>
</LinearLayout>
I think android system will allocate rest of the space to "testLayout", because it is the only one specify the "layout_weight" attribute, but the result is:
The "testLayout" is just disappear, why?
Change height of both View in Relative layout(use fix height in dp).
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="5dp" // fix it in dp
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="5dp" // fix it in dp
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
hope it helps.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="testFun:"
android:textColor="#color/text_black"
android:textSize="#dimen/titleTextSize"
android:textStyle="bold" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray" />
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/testLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="test" />
</LinearLayout>
There is no orientation in the testLayout, try to add a vertical or horizontal orientation to it
EDIT
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="testFun:"
android:textColor="#color/text_black"
android:textSize="#dimen/titleTextSize"
android:textStyle="bold" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/gray" />
<RelativeLayout
android:id="#+id/layout_currentStation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"></View>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:singleLine="true"
android:text="tv_station:"
android:textColor="#color/text_black"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_currentStation"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="6"
android:background="#drawable/shape_home_white_r6"
android:gravity="center_vertical"
android:singleLine="true"
android:textColor="#color/text_black"
android:textColorHint="#color/text_gray"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_nomal_state_arrow"
android:layout_width="30dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/icon_arrow_down" />
<View
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"></View>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/testLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="test" />
</LinearLayout>
I set the Views height to 40dp same as the TextView height and now "testLayout" is visible at the bottom
Hello guys i am facing an issue i want to apply scrollview in this xml because its a registration page and for better ui I need to apply scrollview there once keyboard open user scroll up and down for filling fields but when I applied scrollview there my tab indicators are invisible and I tried to visible but nothing idea was working here is my xml
/* <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="9.15">
<include layout="#layout/view_header"></include>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.4"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/phone"
/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobilenum"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_weight="2.5">
<EditText
android:id="#+id/signup_mobileno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:focusable="true"
android:inputType="number"
android:focusableInTouchMode="true"
android:hint="#string/hint_mobilenum" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- username-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.4"
android:orientation="horizontal"
android:weightSum="3"
android:layout_margin="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/username"
/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_weight="2.5">
<EditText
android:id="#+id/signup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_username" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--password-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.4"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password"
/>
</LinearLayout>
<!--passwordedit text-->
<!--<LinearLayout-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="match_parent"-->
<!--android:orientation="vertical"-->
<!--android:layout_weight="2.5"-->
<!--android:weightSum="2.5">-->
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_password"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_weight="2.5">
<EditText
android:id="#+id/signup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:focusable="true"
android:maxLength="16"
android:inputType="textPassword"
android:focusableInTouchMode="true"
android:hint="#string/hint_password" />
</android.support.design.widget.TextInputLayout>
<!--</LinearLayout>-->
</LinearLayout>
<!-- password indicator-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
>
<!-- dumpy value-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:layout_marginLeft="10dp"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:weightSum="4"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:orientation="horizontal">
<View
android:id="#+id/signup_passwordredindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:layout_marginLeft="3dp"
android:background="#color/passwordstengthunselected"
android:layout_weight="1"
/>
<View
android:id="#+id/signup_passwordyellowindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:background="#color/passwordstengthunselected"
android:layout_weight="1"
/>
<View
android:id="#+id/signup_passwordblueindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:background="#color/passwordstengthunselected"
android:layout_weight="1"
/>
<View
android:id="#+id/signup_passwordgreenindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:background="#color/passwordstengthunselected"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!--indicator closed here-->
<!--password indicator strenght-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.65"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:layout_gravity="center_horizontal|right"
android:gravity="center_horizontal|right"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:visibility="gone"
android:layout_marginRight="3dp"
android:gravity="center_vertical|right"
android:layout_gravity="center_vertical|right"
android:id="#+id/signup_passwordremarks" />
</LinearLayout>
<!--password indicator strenght-->
<!--Repeat Password-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.4"
android:orientation="horizontal"
android:weightSum="3"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/repeat_password"
/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_reconfirmpassword"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_weight="2.5">
<EditText
android:id="#+id/signup_reconfirmpassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:focusable="true"
android:inputType="textPassword"
android:focusableInTouchMode="true"
android:hint="#string/hint_Repeatpassword" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- cnic-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.4"
android:orientation="horizontal"
android:weightSum="3"
android:layout_margin="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/cnic"
/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_cnic"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_weight="2.5">
<EditText
android:id="#+id/signup_cnic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_cnic" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--email address-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.4"
android:orientation="horizontal"
android:weightSum="3"
android:layout_margin="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email"
/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_emailaddress"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
android:layout_weight="2.5">
<EditText
android:id="#+id/signup_emailaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="false"
android:focusable="true"
android:inputType="textEmailAddress"
android:focusableInTouchMode="true"
android:hint="#string/hint_email" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>*/
try below code..
tested & working fine.
`<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="#layout/view_header"></include>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/phone" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobilenum"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical">
<EditText
android:id="#+id/signup_mobileno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_mobilenum"
android:inputType="number"
android:singleLine="false" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- username-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:layout_weight="1.4"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/username" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical">
<EditText
android:id="#+id/signup_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_username"
android:singleLine="false" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--password-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1.4"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password" />
</LinearLayout>
<!--passwordedit text-->
<!--<LinearLayout-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="match_parent"-->
<!--android:orientation="vertical"-->
<!--android:layout_weight="2.5"-->
<!--android:weightSum="2.5">-->
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_password"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical">
<EditText
android:id="#+id/signup_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_password"
android:inputType="textPassword"
android:maxLength="16"
android:singleLine="false" />
</android.support.design.widget.TextInputLayout>
<!--</LinearLayout>-->
</LinearLayout>
<!-- password indicator-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0.1"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:weightSum="3">
<!-- dumpy value-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:gravity="center_vertical">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:orientation="horizontal"
android:weightSum="4">
<View
android:id="#+id/signup_passwordredindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_weight="1" android:background="#color/passwordstengthunselected" />
<View
android:id="#+id/signup_passwordyellowindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:layout_weight="1" android:background="#color/passwordstengthunselected" />
<View
android:id="#+id/signup_passwordblueindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:background="#color/passwordstengthunselected" />
<View
android:id="#+id/signup_passwordgreenindicator"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:background="#color/passwordstengthunselected"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!--indicator closed here-->
<!--password indicator strenght-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal|right"
android:layout_marginLeft="10dp"
android:layout_marginRight="20dp"
android:layout_weight="0.65"
android:gravity="center_horizontal|right"
android:orientation="horizontal"
android:weightSum="3">
<TextView
android:id="#+id/signup_passwordremarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="3dp"
android:gravity="center_vertical|right"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="gone" />
</LinearLayout>
<!--password indicator strenght-->
<!--Repeat Password-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1.4"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/repeat_password" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_reconfirmpassword"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical">
<EditText
android:id="#+id/signup_reconfirmpassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_Repeatpassword"
android:inputType="textPassword"
android:singleLine="false" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!-- cnic-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:layout_weight="1.4"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/cnic" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_cnic"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical">
<EditText
android:id="#+id/signup_cnic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_cnic"
android:singleLine="false" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<!--email address-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:layout_weight="1.4"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="0.5"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_emailaddress"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="2.5"
android:gravity="center_vertical">
<EditText
android:id="#+id/signup_emailaddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="#string/hint_email"
android:inputType="textEmailAddress"
android:singleLine="false" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>`
Or if you want to scroll on focus, add below attribute in Activity tag in Manifest file
`android:windowSoftInputMode="adjustResize"`