I am having an issue with android phones having a bottom action bar where the app screen is being cut off by the action bar in the phone. Please see the screenshot below which better describes my issue. The button is being cut off by the actionbar.
Below is my layout xml file.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#mipmap/main_bg"
tools:context="com.myapp.SeatsActivity">
<RelativeLayout
android:id="#+id/actionbar_layout"
android:layout_width="match_parent"
android:layout_height="#dimen/irctc_actionbar_height"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView4"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:onClick="onClickgoHome"
android:src="#mipmap/iconhome" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="4dp"
android:layout_toLeftOf="#+id/button11"
android:layout_toRightOf="#+id/imageView4"
android:gravity="center"
android:text="SEAT AVAILABILITY"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="#dimen/irctc_actionbar_height"
android:layout_height="#dimen/irctc_actionbar_height"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/trans_button"
android:clickable="true"
android:onClick="onClickShare"
android:padding="4dp"
android:scaleType="fitCenter"
android:src="#mipmap/share" />
<Button
android:id="#+id/button11"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/imageView5"
android:onClick="onClickDate"
android:text="date:"
android:textColor="#color/white" />
</RelativeLayout>
<LinearLayout
android:id="#+id/horizontal_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/actionbar_layout"
android:background="#color/white"
android:orientation="vertical" />
<TextView
android:id="#+id/txtview_trainname"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_below="#+id/horizontal_line"
android:background="#color/irctc_menu_bg_color"
android:gravity="center"
android:text="Train Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/hr2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/txtview_trainname"
android:background="#color/white"
android:orientation="vertical" />
<TextView
android:id="#+id/txtview_fromtostation"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_below="#+id/hr2"
android:background="#color/irctc_menu_bg_color"
android:gravity="center"
android:text="Station Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/hr3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/txtview_fromtostation"
android:background="#color/white"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/layout_table_header"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_below="#+id/hr3"
android:background="#color/irctc_menu_bg_color"
android:orientation="horizontal">
<TextView
android:id="#+id/textView6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/txtview_class1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:gravity="center"
android:text="class1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/txtview_class2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:gravity="center"
android:text="class2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:id="#+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_above="#+id/btn_express_book"
android:layout_alignParentBottom="false"
android:background="#color/irctc_menu_bg_color">
<TextView
android:id="#+id/textView9"
android:layout_width="70dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="Quota:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white" />
<Button
android:id="#+id/btn_quota"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/imageView9"
android:layout_toRightOf="#+id/textView9"
android:background="#drawable/trans_button"
android:onClick="onClickQuota"
android:text="Selected Quota"
android:textColor="#color/white" />
<ImageView
android:id="#+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="#drawable/trans_button"
android:clickable="true"
android:onClick="onClickTrainSchedule"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:scaleType="fitCenter"
android:src="#mipmap/train_schedule" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="#+id/imageView8"
android:background="#drawable/trans_button"
android:clickable="true"
android:onClick="onClickFareEnquery"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:scaleType="fitCenter"
android:src="#mipmap/fair_enquiry" />
</RelativeLayout>
<ListView
android:id="#+id/listview_seatcell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/adView"
android:layout_below="#+id/layout_table_header" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/layout_bottom"
ads:adSize="BANNER"
ads:adUnitId="#string/banner_ad_unit_id" />
<Button
android:id="#+id/btn_express_book"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="#drawable/irctc_button"
android:onClick="onClickExpressBook"
android:paddingBottom="10dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="10dp"
android:text="Express Book!"
android:textColor="#ffffff" />
</RelativeLayout>
Am I doing something wrong here? What changes would I need to make to the xml to accommodate phones with an action bar ?
I've already add ScrollView to your ViewGroup. Check it:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#mipmap/main_bg"
tools:context="com.myapp.SeatsActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
<RelativeLayout
android:id="#+id/actionbar_layout"
android:layout_width="match_parent"
android:layout_height="#dimen/irctc_actionbar_height"
android:orientation="horizontal">
<ImageView
android:id="#+id/imageView4"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="6dp"
android:onClick="onClickgoHome"
android:src="#mipmap/iconhome" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="4dp"
android:layout_toLeftOf="#+id/button11"
android:layout_toRightOf="#+id/imageView4"
android:gravity="center"
android:text="SEAT AVAILABILITY"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="#dimen/irctc_actionbar_height"
android:layout_height="#dimen/irctc_actionbar_height"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/trans_button"
android:clickable="true"
android:onClick="onClickShare"
android:padding="4dp"
android:scaleType="fitCenter"
android:src="#mipmap/share" />
<Button
android:id="#+id/button11"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/imageView5"
android:onClick="onClickDate"
android:text="date:"
android:textColor="#color/white" />
</RelativeLayout>
<LinearLayout
android:id="#+id/horizontal_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/actionbar_layout"
android:background="#color/white"
android:orientation="vertical" />
<TextView
android:id="#+id/txtview_trainname"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_below="#+id/horizontal_line"
android:background="#color/irctc_menu_bg_color"
android:gravity="center"
android:text="Train Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/hr2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/txtview_trainname"
android:background="#color/white"
android:orientation="vertical" />
<TextView
android:id="#+id/txtview_fromtostation"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_below="#+id/hr2"
android:background="#color/irctc_menu_bg_color"
android:gravity="center"
android:text="Station Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<LinearLayout
android:id="#+id/hr3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/txtview_fromtostation"
android:background="#color/white"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/layout_table_header"
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_below="#+id/hr3"
android:background="#color/irctc_menu_bg_color"
android:orientation="horizontal">
<TextView
android:id="#+id/textView6"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/txtview_class1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:gravity="center"
android:text="class1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/txtview_class2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:gravity="center"
android:text="class2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:id="#+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_above="#+id/btn_express_book"
android:layout_alignParentBottom="false"
android:background="#color/irctc_menu_bg_color">
<TextView
android:id="#+id/textView9"
android:layout_width="70dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="Quota:"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/white" />
<Button
android:id="#+id/btn_quota"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/imageView9"
android:layout_toRightOf="#+id/textView9"
android:background="#drawable/trans_button"
android:onClick="onClickQuota"
android:text="Selected Quota"
android:textColor="#color/white" />
<ImageView
android:id="#+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="#drawable/trans_button"
android:clickable="true"
android:onClick="onClickTrainSchedule"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:scaleType="fitCenter"
android:src="#mipmap/train_schedule" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="#+id/imageView8"
android:background="#drawable/trans_button"
android:clickable="true"
android:onClick="onClickFareEnquery"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:scaleType="fitCenter"
android:src="#mipmap/fair_enquiry" />
</RelativeLayout>
<ListView
android:id="#+id/listview_seatcell"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/adView"
android:layout_below="#+id/layout_table_header" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/layout_bottom"
ads:adSize="BANNER"
ads:adUnitId="#string/banner_ad_unit_id" />
<Button
android:id="#+id/btn_express_book"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="#drawable/irctc_button"
android:onClick="onClickExpressBook"
android:paddingBottom="10dp"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:paddingTop="10dp"
android:text="Express Book!"
android:textColor="#ffffff" />
</RelativeLayout>
</ScrollView>
Hope it help
Try Setting android:layout_alignParentBottom="false" to android:layout_alignParentBottom="true" inside of the layout. So something like this.
<RelativeLayout
android:id="#+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_above="#+id/btn_express_book"
android:layout_alignParentBottom="true"
android:background="#color/irctc_menu_bg_color">
Don't use RelativeLayout to imitate LinearLayout.
None of your views overlap, and none of them need need any kind of special alignment with other views. Recreating that with layout_below and layout_above is confusing. Everything you have in your layout can be done with LinearLayouts instead and will be much clearer, except for maybe the two action bars (but even those might be possible with LinearLayouts too).
Don't use empty LinearLayouts as horizontal dividers.
If you have to use a view at all, just use View. But if you are doing this inside of a LinearLayout as I suggest in #1, then you might not need views at all, you could use
android:showDividers="middle"
android:divider="#drawable/hr"
and in res/drawable/hr.xml
<shape android:shape="rectangle">
<size android:height="1dp" />
<solid android:color="#android:color/white" />
</shape>
Don't ever use wrap_content as the height of a ListView.
ListView doesn't know anything about its children. Telling it to be as tall as it needs to contain them doesn't make any sense, and ListView is just going to try to guess. You should always use either a static value, match_parent, or allow it to fill some arbitrary space using layout_weight (if using LinearLayout) or other view boundaries (if using `RelativeLayout).
Combining all of the above, I think your layout should end up looking like this (only the relevant parts are shown):
<LinearLayout android:orientation="vertical" ...>
<RelativeLayout ... /> <!-- Top action bar -->
<TextView ... />
<TextView ... />
<LinearLayout android:orientation="horizontal" ... /> <!-- table header -->
<ListView
android:layout_height="0dp"
android:layout_weight="1"
... />
<AdView ... />
<RelativeLayout ... /> <!-- bottom action bar -->
<Button ... /> <!-- The one that is currently cut off -->
</LinearLayout>
Related
I am not able to find out the exact issue that why the image(background) is not visible in API level 16 but it is showing good in API level 19. I have worked simply as i have done previously but , this time the background is not shown(of WaterMark in ImageView).
I am not able to find out what is exact issue . So i need help.I have done every thing as suggested in the stack Android device is not showing the background image but it is not going good in my case.
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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="#+id/scrollLogin"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlGetInTouch"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<RelativeLayout
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_bg2">
<ImageView
android:id="#+id/brand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/nbl_logo4" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#304EA2">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:layout_marginTop="-60dp"
android:color="#android:color/transparent"
android:src="#drawable/logowatermark" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/edit_text_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text=" Please login to proceed"
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<******.CustomFontEditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Mobile Number"
android:inputType="number"
android:maxLength="#integer/mobile_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontEditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:layout_toLeftOf="#+id/passwordVisibilityBtn"
android:background="#drawable/edit_text_border"
android:drawablePadding="8dp"
android:gravity="center"
android:hint="Password"
android:inputType="textPassword"
android:maxLength="#integer/password_length"
android:padding="13dp"
android:textCursorDrawable="#drawable/color_cursor"
android:textSize="12dp"
android:textStyle="bold" />
<******.CustomFontCheckBox
android:id="#+id/chkSaveUsername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:button="#drawable/custom_checkbox"
android:drawablePadding="5dp"
android:gravity="center"
android:text=" Remember Mobile No."
android:textColor="#color/white"
android:textSize="12sp"
android:textStyle="normal" />
<LinearLayout
android:id="#+id/loginLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#drawable/login_button_shadow"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:id="#+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:padding="13dp"
android:text="Login"
android:textAllCaps="true"
android:textColor="#color/white"
android:textSize="14sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#drawable/login_button_new1"
android:clickable="true"
android:gravity="center"
android:paddingBottom="10dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="10dp"
android:text="Switch To SMS"
android:textColor="#color/white"
android:textSize="12sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<******.CustomFontLoginTextView
android:id="#+id/resetDeviceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_reset_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/reset_device_id_text"
android:textColor="#color/white"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:id="#+id/action_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:alpha="0.7"
android:drawableLeft="#drawable/icon_info_20"
android:drawablePadding="3dp"
android:gravity="center"
android:text="#string/info"
android:textColor="#color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- Promo -->
<LinearLayout
android:id="#+id/llPromotions"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/promo_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llBranches"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlLogin"
android:layout_gravity="center"
android:background="#304EA2"
android:gravity="center"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showATMs"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:padding="2dp"
android:src="#drawable/icon_atm_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="ATM"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest Atm Machines"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:clickable="true"
android:onClick="showBranches"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_branches_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="8dp"
android:text="BRANCHES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Locate nearest bank branches"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:clickable="true"
android:onClick="showRates"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:src="#drawable/ic_rates_50_6" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:text="RATES"
android:textColor="#FFFFFF"
android:textSize="12sp" />
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="3dp"
android:text="Foreign exchange and stock rates"
android:textColor="#FFFFFF"
android:textSize="8sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/rlProducts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<******.CustomFontLoginTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Products"
android:textAllCaps="true"
android:textColor="#color/gray"
android:textSize="14sp" />
<!--Product Container-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!--Product 1-->
<LinearLayout
android:id="#+id/product_content1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="7.5dp"
android:layout_weight="1"
android:orientation="vertical" />
<!--Product 2-->
<LinearLayout
android:id="#+id/product_content2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="7.5dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:gravity="end"
android:orientation="vertical" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rlGetInTouch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#304EA2"
android:orientation="horizontal">
<CustomFontLoginTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/btnCall"
android:paddingLeft="15dp"
android:singleLine="true"
android:text="Get in touch with us"
android:textColor="#color/white"
android:textSize="16sp"
android:textStyle="normal" />
<!--app:maxTextSize="14sp"
app:minTextSize="#dimen/minFontSize"-->
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnMap"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:onClick="showLocation"
android:src="#drawable/ic_action_location_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnEmail"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnMap"
android:layout_toStartOf="#+id/btnMap"
android:onClick="openEmail"
android:src="#drawable/ic_action_mail_24_4" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/btnCall"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/btnEmail"
android:layout_toStartOf="#+id/btnEmail"
android:onClick="openCall"
android:src="#drawable/ic_action_call_24_4" />
</RelativeLayout>
</RelativeLayout>
The Image background of watermark is not shown. I have done nothing
new ,same as previous but dont' know that is the exact issue.
Please reduce image size to visible in the lower level device.
I Just Removed marginTop and it worked fine in API level 16
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginBottom="35dp"
android:src="#drawable/logowatermark" />
I don't understand that why it worked when i remove the -ve marginTop
in above? .I got solution but don't understand what exactly happened
in adding -ve marginTop and with removing -ve marginTop.
i have a scroll view showing certain device information, but it looks like this after setting a DrawableLeft . how do i fix this behaviour? when i remove the drawable, the list looks well formatted. any help will be appreciated
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" >
<!-- action bar -->
<RelativeLayout
android:id="#+id/actionbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:background="#0080FF" >
<ImageView
android:id="#+id/imageView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/imageButton1"
android:layout_toRightOf="#+id/imageView5"
android:src="#drawable/ic_font" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="5dp"
android:src="#drawable/ic_return" />
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#00000000"
android:onClick="shareapp"
android:src="#drawable/ic_share" />
</RelativeLayout>
<!-- action bar -->
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/actionbar"
android:background="#drawable/antivirus_bg"
android:padding="10dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/ipip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_device_info"
android:gravity="center"
android:text="ip"
android:textColor="#084B8A"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/macmac"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_device_info"
android:gravity="center"
android:text="mac"
android:textColor="#084B8A"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/macmac2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_device_info"
android:gravity="center"
android:text="mac2"
android:textColor="#084B8A"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/ssid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_device_info"
android:gravity="center"
android:text="ssid"
android:textColor="#084B8A"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/pubip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_device_info"
android:gravity="center"
android:text="ip2"
android:textColor="#084B8A"
android:textSize="18sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/unique_id_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_device_info"
android:gravity="center"
android:text="extra"
android:textColor="#084B8A"
android:textSize="18sp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
You should use an imageview with specify with and height instead of drawableLeft. Because drawableLeft or drawableRight will get drawable with real with and height of image.
You can remake layout as below:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
>
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:src="#drawable/ic_launcher"
/>
<TextView
android:id="#+id/ipip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="ip"
android:layout_marginLeft="16dp"
android:textColor="#084B8A"
android:textSize="18sp" />
</LinearLayout>
I am using a RecyclerView with CardViews inside and I want to remove the Margins/Padding/Spacing left in between the children cards inside the RecyclerView. How can I do that?
Here is my CardView:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<!--status lock-->
<ImageView
android:id="#+id/imageField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="20dp" />
<!--text info section-->
<LinearLayout
android:id="#+id/textInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<!--NAME-->
<TextView
android:id="#+id/nameField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item name"
android:gravity="center_vertical"
android:textSize="#dimen/abc_text_size_large_material" />
<!--category-->
<TextView
android:id="#+id/categoryField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:text="category"
android:textSize="#dimen/abc_text_size_small_material" />
<!--working hours-->
<LinearLayout
android:id="#+id/workingHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:orientation="horizontal">
<ImageView
android:id="#+id/workingHoursIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_clock"
android:padding="50dp"></ImageView>
<TextView
android:id="#+id/WHStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp" />
<TextView
android:id="#+id/dash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text=" - " />
<TextView
android:id="#+id/WHEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp" />
</LinearLayout>
<!--message-->
<LinearLayout
android:id="#+id/messageSection"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/messageIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_message"
android:padding="50dp" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp"
android:text="No Message" />
</LinearLayout>
</LinearLayout>
<!--add to favorite button-->
<ImageButton
android:id="#+id/btn_add_to_favorite_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="20dp"
android:layout_marginStart="48dp"
android:background="#drawable/ic_star_gray" />
</LinearLayout>
</android.support.v7.widget.CardView>
And my RecyclerView:
<android.support.v7.widget.RecyclerView
android:id="#+id/my_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/my_store"
android:scrollbars="vertical" />
Here is a screenshot:
This might be what you were looking for CardView inside RecyclerView has extra margins
Plus if you are not looking to keep spaces you should simply use a LinearLayout for your adapter layout removing the CardView altogether, that should do it.
Hope that helps.
Check if it is margin or padding (Dev Options / show layout bounds)
CardView adds padding in pre-L API levels to show shadows. In L, unless you set useCompatPadding=true, there should not be any gap.
Adding negative margins (although it is ugly) should work.
This might work
card_view:contentPaddingLeft="-3dp"
card_view:contentPaddingRight="-3dp"
card_view:contentPaddingTop="-3dp"
card_view:contentPaddingBottom="-3dp"
Try this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<!--status lock-->
<ImageView
android:id="#+id/imageField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="20dp" />
<!--text info section-->
<LinearLayout
android:id="#+id/textInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<!--NAME-->
<TextView
android:id="#+id/nameField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="item name"
android:gravity="center_vertical"
android:textSize="#dimen/abc_text_size_large_material" />
<!--category-->
<TextView
android:id="#+id/categoryField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:text="category"
android:textSize="#dimen/abc_text_size_small_material" />
<!--working hours-->
<LinearLayout
android:id="#+id/workingHours"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:orientation="horizontal">
<ImageView
android:id="#+id/workingHoursIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_clock"
android:padding="50dp"></ImageView>
<TextView
android:id="#+id/WHStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp" />
<TextView
android:id="#+id/dash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text=" - " />
<TextView
android:id="#+id/WHEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp" />
</LinearLayout>
<!--message-->
<LinearLayout
android:id="#+id/messageSection"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/messageIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_gravity="center_vertical"
android:background="#drawable/ic_message"
android:padding="50dp" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:lines="1"
android:maxLines="1"
android:paddingLeft="5dp"
android:text="No Message" />
</LinearLayout>
</LinearLayout>
<!--add to favorite button-->
<ImageButton
android:id="#+id/btn_add_to_favorite_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="20dp"
android:layout_marginStart="48dp"
android:background="#drawable/ic_star_gray" />
</LinearLayout>
How do i place a line between two linearlayouts horizontally? I tried with a additional linearlayout and a one time with a View. My linearlayouts looks currently like this:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
android:orientation="horizontal"
>
<LinearLayout
android:id="#+id/about"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:gravity="start"
android:layout_gravity="start"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground"
>
<ImageView
android:id="#+id/about_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_marginStart="20dp"
android:layout_gravity="start|center_vertical"
android:src="#drawable/ic_info_black_24dp"
android:clickable="false"
/>
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_gravity="start|center_vertical"
android:text="About"
android:textSize="20sp"
android:textColor="#android:color/black"
android:clickable="false"
/>
</LinearLayout>
<!--<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="2"
android:elevation="0dp"
android:background="#android:color/black"
/>-->
<LinearLayout
android:id="#+id/theme"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:layout_weight="3"
android:gravity="end"
android:layout_gravity="end"
android:background="?android:attr/selectableItemBackground"
>
<ImageView
android:id="#+id/theme_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_marginEnd="10dp"
android:layout_gravity="end|center_vertical"
android:src="#drawable/ic_palette_white_24dp"
android:tint="#android:color/black"
android:clickable="false"
/>
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="20dp"
android:text="Theme"
android:textSize="20sp"
android:textColor="#android:color/black"
android:clickable="false"
/>
</LinearLayout>
</LinearLayout>
It looks currently like this(the layout on the right side, is a bit more left, dont understand why ^^):
Any suggestions?
Why not use a RelativeLayout and avoid weights all together. Try this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android">
<View
android:id="#+id/divider"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:elevation="0dp"
android:background="#android:color/black" />
<LinearLayout
android:id="#+id/about"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:layout_toLeftOf="#id/divider"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="#+id/about_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_marginStart="20dp"
android:layout_gravity="start|center_vertical"
android:src="#drawable/ic_launcher"
android:clickable="false"
/>
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_gravity="start|center_vertical"
android:text="About"
android:textSize="20sp"
android:textColor="#android:color/black"
android:clickable="false"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/theme"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:layout_toRightOf="#id/divider"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="#+id/theme_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:layout_marginEnd="10dp"
android:layout_gravity="end|center_vertical"
android:src="#drawable/ic_launcher"
android:tint="#android:color/black"
android:clickable="false"
/>
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="20dp"
android:text="Theme"
android:textSize="20sp"
android:textColor="#android:color/black"
android:clickable="false"
/>
</LinearLayout>
Get rid of the weights and use a Relative layout to hold your linear layouts. Then add this in your XML:
<View android:id="#+id/separator"
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"/>
Then in the layout you want to the right add this line:
android:layout_toRightOf="#+id/separator"
And then for the layout to the left:
android:layout_toLeftOf="#+id/separator"
I have this layout with a scrollview inside:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#eeeeee">
<!-- HEADER -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ffffff"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#868686"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:id="#+id/parent_linear"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#drawable/gradient_header" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_marginBottom="#dimen/margin_normal"
android:layout_marginTop="#dimen/margin_small"
android:gravity="center_horizontal"
android:text="#string/proposed_plan_prompt"
android:textColor="#797A77"
android:textSize="15sp"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#C7C7C7"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#drawable/gradient_header_separator"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
<!-- BODY -->
<!-- Proposed plan (summary) -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_normal"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_normal"
android:background="#drawable/border"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="#dimen/margin_small"
android:layout_marginRight="#dimen/margin_small"
android:orientation="vertical" >
<TextView
android:id="#+id/providerNameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="ABCD"
android:textSize="25sp"
android:textStyle="bold" />
<TextView
android:id="#+id/planView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="1234"
android:textSize="12sp"
android:textColor="#737373"/>
</LinearLayout>
<View
android:id="#+id/separator"
android:layout_width="1dip"
android:layout_height="50dp"
android:layout_marginTop="#dimen/margin_small"
android:background="#drawable/gradient_vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_alignParentRight="true"
android:layout_marginLeft="#dimen/margin_small"
android:layout_marginRight="#dimen/margin_small"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:layout_marginLeft="#dimen/margin_small"
android:layout_marginRight="#dimen/margin_small"
android:gravity="top"
android:orientation="horizontal" >
<TextView
android:id="#+id/priceView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="XY"
android:textSize="32sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="+123"
android:textColor="#565756"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/totPriceView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="(information)"
android:textColor="#737373"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_normal"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_small"
android:layout_marginTop="#dimen/margin_normal"
android:orientation="vertical" >
<TextView
android:id="#+id/detailsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Choose:"
android:textSize="12sp"
android:textStyle="bold" />
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/detailsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/margin_small"
android:text="Best"
android:textColor="#737373"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/detailsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/margin_normal"
android:text="Details:"
android:textSize="12sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_normal"
android:layout_marginLeft="#dimen/margin_normal"
android:layout_marginRight="#dimen/margin_small"
android:layout_marginTop="#dimen/margin_small"
android:background="#drawable/border"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="90dp"
android:layout_marginRight="#dimen/margin_small"
android:background="#drawable/border"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/line1Layout"
android:layout_width="match_parent"
android:layout_height="30sp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/line1Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/font_normal" />
<TextView
android:id="#+id/line1Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/border_attribute"
android:textSize="#dimen/font_normal"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/line2Layout"
android:layout_width="match_parent"
android:layout_height="30sp"
android:background="#EAEAEA"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/line2Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/font_normal" />
<TextView
android:id="#+id/line2Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/border_attribute"
android:textSize="#dimen/font_normal"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/line3Layout"
android:layout_width="match_parent"
android:layout_height="30sp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/line3Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/font_normal" />
<TextView
android:id="#+id/line3Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/border_attribute"
android:textSize="#dimen/font_normal"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/line4Layout"
android:layout_width="match_parent"
android:layout_height="30sp"
android:background="#EAEAEA"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/line4Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/font_normal" />
<TextView
android:id="#+id/line4Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/border_attribute"
android:textSize="#dimen/font_normal"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/line5Layout"
android:layout_width="match_parent"
android:layout_height="30sp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/line5Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/font_normal" />
<TextView
android:id="#+id/line5Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/border_attribute"
android:textSize="#dimen/font_normal"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/line6Layout"
android:layout_width="match_parent"
android:layout_height="30sp"
android:background="#EAEAEA"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:id="#+id/line6Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="#dimen/font_normal" />
<TextView
android:id="#+id/line6Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#drawable/border_attribute"
android:textSize="#dimen/font_normal"
android:visibility="invisible" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<ImageView
android:id="#+id/imageView1"
android:layout_width="100dp"
android:layout_height="140dp"
android:layout_gravity="left|center_vertical"
android:src="#drawable/robin4" />
</FrameLayout>
<Button
android:id="#+id/button_proposed_extras"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/margin_small"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="#dimen/margin_normal"
android:background="#drawable/button_transparent"
android:text="#string/extras_title"
android:textColor="#298A17"
android:textStyle="bold|italic"
android:visibility="invisible" />
</LinearLayout>
<Button
android:id="#+id/button_proposed_change"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_normal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#drawable/button"
android:text="#string/proposition_change_title"
android:textColor="#ffffff"
android:textStyle="bold" />
<Button
android:id="#+id/button_proposed_no_change"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_normal"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#drawable/button_silver"
android:text="#string/proposition_no_change_title"
android:textColor="#298A17"
android:textStyle="bold" />
</LinearLayout>
The part with the scrollview displays at maximum size and is not scrolling.
The two buttons at the end are not displayed, they apparently don't fit in the screen.
I'd like to have the scroll working in order to have buttons appearing.
Why the scrolled layout is displayed at max size instead of being scrolled?
What would be the solution?
For making the buttons to appear in the screen you should have the buttons within the scroll too. Mostly, the screens that you design should have scrollview as the parent if the screen contains many components. Main ScrollView -> LinearLayout / RelativeLayout -> Add Components as needed. By doing so you should have be able to see the buttons also. In doing this way even if your layout changes to landscape the components wont get hidden and will be shown in the scroll. Hope you get my point and it helps you in solving your issue.
As far as the code above is concerned you will not be able to see the buttons as buttons are not within scrollview and hence the view below is hidden.
If doesn't scroll because its height is wrap_content.
As ChristopheCVB stated, your ScrollView needs to NOT be wrap_content. A ScrollView will only scroll if the content it contains is larger (read taller for a vertical ScrollView and wider for a horizontal ScrollView) that the ScrollView itself. If it is smaller, then it has no need to scroll.