Layout is not pushing up when soft keyboard appears - android

I have designed layout by taking the reference from this and code for the same is below.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ll_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/action_bar_color"
android:minHeight="?attr/actionBarSize">
<TextView
android:id="#+id/txt_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="#dimen/image_margin_left"
android:text="#string/app_name"
android:textColor="#android:color/black"
android:textSize="#dimen/login_txt_size" />
<ImageView
android:id="#+id/img_refresh"
android:layout_width="#dimen/logo_image_w"
android:layout_height="#dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/image_margin_left"
android:background="#drawable/custom_image_click"
android:src="#drawable/ic_action_refresh" />
<ImageView
android:id="#+id/img_setting"
android:layout_width="#dimen/logo_image_w"
android:layout_height="#dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/image_margin_left"
android:background="#drawable/custom_image_click"
android:src="#drawable/ic_action_settings" />
<ImageView
android:id="#+id/img_wifi"
android:layout_width="#dimen/logo_image_w"
android:layout_height="#dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/image_margin_left"
android:background="#drawable/custom_image_click"
android:src="#drawable/ic_wifi_on"
android:tint="#color/button_theme_color" />
</android.support.v7.widget.Toolbar>
<TextView
android:id="#+id/tv_home_networkStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#003b60"
android:gravity="center_horizontal"
android:padding="10dp"
android:text="Medium Text"
android:textColor="#FFFF0000"
android:textSize="20sp"
android:visibility="visible" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="10">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="50dp"
android:src="#drawable/logo_login" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_weight="6"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/round_masjid_corner"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:src="#drawable/masjid" />
<View
android:layout_width="5dp"
android:layout_height="match_parent"
android:background="#drawable/user_sep" />
<EditText
android:id="#+id/edt_clientid"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#null"
android:hint="Client ID"
android:inputType="number"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#drawable/round_kiosk_corner"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#null"
android:padding="20dp"
android:src="#drawable/tablet" />
<View
android:layout_width="5dp"
android:layout_height="match_parent"
android:background="#drawable/pass_sep" />
<EditText
android:id="#+id/edt_device_code"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#null"
android:hint="Device Code"
android:inputType="text"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<Button
android:id="#+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/custom_button_frag_menu"
android:padding="20dp"
android:text="Login"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="35sp" />
<Button
android:id="#+id/btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/custom_button_frag_menu"
android:padding="20dp"
android:text="Cancel"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
And code of manifest is below
<activity android:name=".activity.LoginActivity"
android:theme="#style/AppTheme.NoActionBar"
android:screenOrientation="landscape"
android:windowSoftInputMode="adjustPan|adjustResize">
</activity>
But still it gives output like . When soft keyboard is appearing buttons are hiding below of the soft keyboard.I have tried by using adjustResize as well as adjustPan,but still no change in output.I have added ScrollView too If anyone is having the solution please help

Try this make ScrollView as parent root layout like below code
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ll_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/action_bar_color"
android:minHeight="?attr/actionBarSize">
<TextView
android:id="#+id/txt_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="#dimen/image_margin_left"
android:text="#string/app_name"
android:textColor="#android:color/black"
android:textSize="#dimen/login_txt_size" />
<ImageView
android:id="#+id/img_refresh"
android:layout_width="#dimen/logo_image_w"
android:layout_height="#dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/image_margin_left"
android:background="#drawable/custom_image_click"
android:src="#drawable/ic_action_refresh" />
<ImageView
android:id="#+id/img_setting"
android:layout_width="#dimen/logo_image_w"
android:layout_height="#dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/image_margin_left"
android:background="#drawable/custom_image_click"
android:src="#drawable/ic_action_settings" />
<ImageView
android:id="#+id/img_wifi"
android:layout_width="#dimen/logo_image_w"
android:layout_height="#dimen/logo_image_h"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/image_margin_left"
android:background="#drawable/custom_image_click"
android:src="#drawable/ic_wifi_on"
android:tint="#color/button_theme_color" />
</android.support.v7.widget.Toolbar>
<TextView
android:id="#+id/tv_home_networkStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#003b60"
android:gravity="center_horizontal"
android:padding="10dp"
android:text="Medium Text"
android:textColor="#FFFF0000"
android:textSize="20sp"
android:visibility="visible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="10">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="50dp"
android:src="#drawable/logo_login" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
android:layout_weight="6"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/round_masjid_corner"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:src="#drawable/masjid" />
<View
android:layout_width="5dp"
android:layout_height="match_parent"
android:background="#drawable/user_sep" />
<EditText
android:id="#+id/edt_clientid"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#null"
android:hint="Client ID"
android:inputType="number"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#drawable/round_kiosk_corner"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#null"
android:padding="20dp"
android:src="#drawable/tablet" />
<View
android:layout_width="5dp"
android:layout_height="match_parent"
android:background="#drawable/pass_sep" />
<EditText
android:id="#+id/edt_device_code"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#null"
android:hint="Device Code"
android:inputType="text"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<Button
android:id="#+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/custom_button_frag_menu"
android:padding="20dp"
android:text="Login"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="35sp" />
<Button
android:id="#+id/btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/custom_button_frag_menu"
android:padding="20dp"
android:text="Cancel"
android:textAllCaps="false"
android:textColor="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
than apply android:windowSoftInputMode="adjustResize" in manifest file to your activity
NOTE: - fullscreen mode doesn't resize

Related

Fragment layout is not scrolling above keyboard when soft keyboard pop ups

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
)

Background image is not visible if background of above of view is set

I am working on android app where I want to design layout such that "Success" image (20%) - Linearlayout should be top layout and 60%(RelativeLayout) should be in center layout and 20%(LinearLayout) should be on bottom layout.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_background"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/grey_background"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="15dp">
<ImageView
android:id="#+id/trans_status_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sucessfull" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/trans_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Transaction Successfull"
android:textColor="#color/black"
android:textSize="17sp" />
</LinearLayout>
<!--<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/white"
android:elevation="4dp"
>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/bill_top" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="-5dp"
android:background="#color/white"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:orientation="vertical"
android:visibility="gone">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/sender_mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Mobile No."
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_acc_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="A/C No."
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/trans_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Type"
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_ifsc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="IFSC"
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/dark_grey"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/white"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="3dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/status_stamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:src="#drawable/success"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transfer Amount:"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="#color/grey_background" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transfer Charges:"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/charges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|right"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/amount_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:textColor="#color/black"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Total Amount"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
</LinearLayout>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#fafafa"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:text="Transaction details"
android:textColor="#color/black"
android:textSize="16sp" />
<ListView
android:id="#+id/trans_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:divider="#null"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="8dp"
android:scrollbars="vertical" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/bill_bottom"
android:visibility="visible" />
</LinearLayout>
<!--
</android.support.v7.widget.CardView>
-->
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
If you want to divide the screen on the percentage basis, take LinearLayout as root and then use weight to divide the whole screen in the ratio as needed.
To bring the view on top, after your view is created and attached, add this line:
view.bringToFront();

How To manage imageviews and textview with theirs alignments?

How To manage imageviews and textview with theirs alignments ?
here is code i have tried.. i have used toolbar to achieve this but failed to achieve , can anyone tell me how to accomplish this ?
<android.support.v7.widget.Toolbar
android:background="#color/backcolor"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="8">
<TextView
android:layout_weight="2"
android:drawableTop="#drawable/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Grid"
android:textSize="15sp"
android:textColor="#color/white"
android:textStyle="bold"
/>
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
<ImageView
android:layout_weight="2"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/a"
android:layout_gravity="center" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
out put i want
Try this code.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 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="wrap_content"
android:layout_alignParentBottom="true"
android:background="?attr/fillColor"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="1dip"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#000000" />
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="?attr/fillColor" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:drawableTop="#drawable/ic_launcher"
android:gravity="center"
android:text="Test"
android:textColor="?attr/fillColor"
android:textSize="15sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Here is Screen Shot.
Try following layout:
<android.support.v7.widget.Toolbar
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="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/com_facebook_button_background_color"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:background="#color/colorWhite"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="2"
android:drawableTop="#drawable/a"
android:gravity="center"
android:text="Grid"
android:textColor="#color/colorWhite"
android:textSize="15sp"
android:textStyle="bold"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.Toolbar>
Try this way it works for me
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:Fnt_Awsm_Button="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/fbutton_color_whight"
android:orientation="vertical"
android:padding="#dimen/marging_pading_8pd">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="4"
android:background="#f0ff"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="50dp"
android:background="#ff00ff"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="#drawable/batss"
android:layout_gravity="center_horizontal"
/>
<TextView
android:layout_width="wrap_content"
android:text="Grid"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
use 4 textview only
[<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/actvity1_padda" >
<TextView
android:id="#+id/main_comp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_secton8"
android:text="#string/comp" />
<TextView
android:id="#+id/main_learn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/lean_businesstip"
android:text="#string/learn" />
<TextView
android:id="#+id/main_mydoc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_increase"
android:text="#string/mydoc" />
<TextView
android:id="#+id/main_business"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableTop="#drawable/chat_secton8"
android:text="Business" />
</LinearLayout>][1]

Can't get to the bottom of the content with my scrollview

I have my xml file. It is a RelativeLayout with a ScrollView and inside the ScrollView I have LinearLayout and many more. The problem is that I can't reach the end of the view, as you can see it end with a "Sign Up" button... But my view is cut by the scroll and I can just see the middle of the button, the other middle is off screen.
So, any suggestions for how can I fix this? How can I work with the ScrollView so it wraps all of my content...
Check 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:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg_signup"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignUp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:background="#xml/signup_round">
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/new_signup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="#string/signup"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
<EditText
android:id="#+id/first_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="-25dp"
android:hint="#string/first_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/last_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/last_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email_confirmation"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password_confirmation"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/sex"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/sex_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-25dp"
android:entries="#array/sex_array" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/brithday"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:orientation="horizontal">
<Button
android:id="#+id/birthdayBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#color/fbutton_color_transparent"
android:onClick="showDatePickerDialog"
android:text="#string/birthdayBtn"
android:textAllCaps="false"
android:textColor="#color/colorRB" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/dateSelectedTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="--/--/--"
android:textColor="#color/colorRB"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingBottom="5dp"
android:text="#string/terms_conditions"
android:textColor="#color/colorRB"
android:textStyle="bold" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#xml/button_round"
android:onClick=""
android:text="#string/signup"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick=""
android:src="#drawable/close_signup" />
</RelativeLayout>

Scrollview doesnt work when scrolled on webview on android version lower than 16

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fbutton="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/progressBarLL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#color/app_background_color"
android:gravity="center"
android:visibility="visible">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollableContent"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="4dp">
<LinearLayout
android:id="#+id/navigationControlLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp"
android:weightSum="4">
<ImageView
android:id="#+id/previousPageImageView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/previous_page_darken" />
<TextView
android:id="#+id/dealsPageNumberStatus"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="center"
android:text="1/50"
android:textSize="#dimen/text_size_medium" />
<ImageView
android:id="#+id/nextPageImageView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/next_page_darken" />
</LinearLayout>
<LinearLayout
android:id="#+id/dealsFragmentLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="#dimen/margin_large"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_normal"
android:layout_marginTop="4dp"
android:background="#drawable/background_with_shadow"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:orientation="horizontal"
android:paddingTop="0dp">
<ImageView
android:id="#+id/dealsFragmentImage"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="2"
android:background="#android:color/transparent"
android:minHeight="#dimen/min_image_height"
android:padding="5dp"
android:src="#drawable/test_logo" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4.00"
android:orientation="vertical"
android:padding="#dimen/padding_normal">
<TextView
android:id="#+id/dealsFragmentTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:text="This text is intentionally made larger to go beyound 2 lines"
android:textSize="#dimen/text_size_medium"
android:padding="#dimen/padding_normal" />
<TextView
android:id="#+id/dealsTimeSubmitted"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:text="about an hour ago "
android:textColor="#color/light_grey"
android:textSize="#dimen/text_size_small"
android:padding="#dimen/padding_normal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal"
android:padding="#dimen/padding_normal">
<TextView
android:id="#+id/dealsCurrentPrice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:padding="4dp"
android:text="Rs. 135"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_large"
android:textStyle="bold" />
<TextView
android:id="#+id/dealsOffPercent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:padding="4dp"
android:text="(90% off)"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_medium" />
<TextView
android:id="#+id/dealsOriginalPrice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:padding="4dp"
android:text="1235698"
android:singleLine="true"
android:textColor="#color/light_grey"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:paddingLeft="4dp"
android:text="#string/submitted_by"
android:textColor="#color/light_text"
android:textSize="#dimen/text_size_small" />
<TextView
android:id="#+id/dealsFragmentSubmittedBy"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:text=" aniket007"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_small" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="left|center"
android:text=" in "
android:textColor="#color/light_text"
android:textSize="#dimen/text_size_small" />
<TextView
android:id="#+id/dealsCategory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="left|center"
android:maxLines="1"
android:paddingRight="4dp"
android:text="Mobiles and Mobile Accessories"
android:textColor="#color/deals_blue"
android:textSize="#dimen/text_size_small" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="10dp"
android:background="#color/item_separator"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_normal" />
<WebView
android:id="#+id/dealDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:contentDescription="#string/top_deals"
android:textSize="#dimen/text_size_medium" />
<include
layout="#layout/list_item_deal_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<!--<LinearLayout
android:id="#+id/dealsFragmentCommentLinearLayout"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="#color/deals_footer"
android:orientation="horizontal">
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
<ImageView
android:id="#+id/dealsFragmentLikeImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:src="#drawable/comment_icon" />
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
<ImageView
android:id="#+id/dealsFragmentDislikeImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:src="#drawable/comment_icon" />
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
<ImageView
android:id="#+id/dealsFragmentShareImage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/popularity_icon" />
<View
android:layout_width="1dip"
android:layout_height="fill_parent"
android:background="#color/flat_grey" />
</LinearLayout>
<info.hoang8f.widget.FButton
android:id="#+id/viewCommentsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:minHeight="#dimen/fb_button_min_height"
android:text="#string/viewComments"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_medium"
fbutton:buttonColor="#color/fbutton_default_color"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/fbutton_default_shadow_color"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="2dp" />-->
<info.hoang8f.widget.FButton
android:id="#+id/buyNowButtonPlaceHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:minHeight="#dimen/fb_button_min_height"
android:text="#string/buy_now"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_medium"
android:visibility="invisible"
fbutton:buttonColor="#color/fbutton_default_color"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/fbutton_default_shadow_color"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="2dp" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#ccffffff">
<info.hoang8f.widget.FButton
android:id="#+id/buyNowButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:minHeight="#dimen/fb_button_min_height"
android:minWidth="#dimen/buy_now_button_width"
android:text="#string/buy_now"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_medium"
fbutton:buttonColor="#color/fbutton_default_color"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/fbutton_default_shadow_color"
fbutton:shadowEnabled="true"
fbutton:shadowHeight="2dp" />
</RelativeLayout>
</RelativeLayout>
I am using WebView inside ScrollView and it does work correctly on android versions higher than 16. But on lower version page do not get scrolled when scrolled on webview. Page does get scrolled from right side of page. Links too do not open when clicked on left side but does open from right side.
found few solutions like android:hardwareAccelerated="true", but not working.

Categories

Resources