i have a layout which looks like this:
at top i have a ChipView(a view group which resize itself according to content in it)
and bottom of it i have a editText and after that there's another view (which contains 2 buttons)
so far everything is fine here.
but then when i start typing (editing) in editText this is how it looks :
the above is totally fine my EditText resized itself to let other elements visible in the layout , but the problem starts when i have a whole bunch of contents in my chipView (layout at top)
as i added content in my first layout the EditText resized itself and when editing of editText starts it becomes not visible because the chipView has taken all the space
so my question is this how can i resize the chipView when editing starts so that my EditText can be visible
my activity's manifest :
<activity android:name=".myActivity"
android:theme="#style/AppTheme.NoActionBar"
android:configChanges="orientation|keyboardHidden|screenSize|screenLayout"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden"/>
my Xml of Activity
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#color/black_30">
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:id="#+id/toolbarAnnouncement"
android:theme="#style/ToolBarStyle"
android:elevation="5dp"
android:textAlignment="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:id="#+id/toolbar_title"
android:textSize="20sp"
android:textStyle="bold"
android:background="#00000000"
android:textColor="#ffffff" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="15"
android:id="#+id/channelContainer"
android:orientation="horizontal"
android:layout_below="#+id/toolbarAnnouncement"
android:background="#color/material_grey_50">
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="To :"
android:id="#+id/textView16"
android:textSize="20sp"
android:paddingLeft="5dp"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="11"
android:id="#+id/chipViewLayout"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<com.plumillonforge.android.chipview.ChipView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/buttonChannelSelectorAnnouncement"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="left"
android:padding="5dp"
android:minHeight="90dp" />
</RelativeLayout>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:id="#+id/buttonRemoveChannel"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage1"
android:layout_below="#+id/channelContainer"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach1"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach1"
android:layout_alignParentBottom="false"
android:layout_toRightOf="#+id/imageViewAttach1"
android:layout_toEndOf="#+id/imageViewAttach1"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_centerInParent="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="60dp"
android:layout_height="35dp"
android:text="Remove"
android:id="#+id/buttonRemoveAttach1"
android:background="#drawable/rounded_corner_filled"
android:textColor="#ffffff"
android:textSize="13sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp" />
<Button
android:layout_width="60dp"
android:layout_height="35dp"
android:text="Retry"
android:id="#+id/buttonRetry1"
android:textColor="#ffffff"
android:layout_centerVertical="true"
android:background="#drawable/rounded_corner_filled"
android:layout_toLeftOf="#+id/buttonRemoveAttach1"
android:layout_toStartOf="#+id/buttonRemoveAttach1"
android:layout_marginRight="5dp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage2"
android:layout_below="#+id/attacheImage1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach2"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach2"
android:layout_alignParentBottom="false"
android:layout_toRightOf="#+id/imageViewAttach2"
android:layout_toEndOf="#+id/imageViewAttach2"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_centerVertical="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="60dp"
android:layout_height="35dp"
android:text="Remove"
android:id="#+id/buttonRemoveAttach2"
android:background="#drawable/rounded_corner_filled"
android:textColor="#ffffff"
android:textSize="13sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp" />
<Button
android:layout_width="60dp"
android:layout_height="35dp"
android:text="Retry"
android:id="#+id/buttonRetry2"
android:textColor="#ffffff"
android:background="#drawable/rounded_corner_filled"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/buttonRemoveAttach2"
android:layout_toStartOf="#+id/buttonRemoveAttach2"
android:layout_marginRight="5dp"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage3"
android:layout_below="#+id/attacheImage2"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach3"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/icon_admin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach3"
android:layout_alignParentBottom="false"
android:layout_toRightOf="#+id/imageViewAttach3"
android:layout_toEndOf="#+id/imageViewAttach3"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_centerVertical="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="60dp"
android:layout_height="35dp"
android:text="Remove"
android:id="#+id/buttonRemoveAttach3"
android:background="#drawable/rounded_corner_filled"
android:textColor="#ffffff"
android:textSize="13sp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp" />
<Button
android:layout_width="60dp"
android:layout_height="35dp"
android:text="Retry"
android:id="#+id/buttonRetry3"
android:layout_centerVertical="true"
android:textColor="#ffffff"
android:background="#drawable/rounded_corner_filled"
android:layout_toLeftOf="#+id/buttonRemoveAttach3"
android:layout_toStartOf="#+id/buttonRemoveAttach3"
android:layout_marginRight="5dp"
android:visibility="gone" />
</RelativeLayout>
<EditText
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:ems="10"
android:fitsSystemWindows="true"
android:id="#+id/editTextDescriptionAnnouncement"
android:hint="Type your announcement..."
android:gravity="top"
android:padding="5dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="#+id/attacheImage3"
android:background="#ffffff"
android:layout_above="#+id/relativeLayout4" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#color/button_material_light"
android:id="#+id/relativeLayout4">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Image"
android:id="#+id/buttonAddImage"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Send"
android:id="#+id/buttonSendAnnouncement"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
Related
Is there a way to do this in android studio? I want to achieve that when you scroll down the header will overlap above and under is the scrollview part. What I've got is it scrolls over the header. In android studio
This is what Im trying to achieve that was made in figma
Default
When you scroll
So far this is what my code looks like
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".Fragment.RecordFragment"
android:orientation="vertical">
<View
android:layout_width="369dp"
android:layout_height="71dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="13dp"
android:layout_alignParentTop="true"
android:layout_marginTop="14dp"
android:background="#drawable/ic_header"/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="25dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="25dp"
android:text="Record"
android:textAlignment="center"
android:textColor="#color/white"
android:textSize="35sp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="100dp">
<TextView
android:id="#+id/txtDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="128dp"
android:text="Date for today"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="50sp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="316dp"
android:layout_height="201dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:background="#drawable/sec_bp" />
<EditText
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="70dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:hint="SBP" />
<EditText
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="120dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:hint="DBP" />
<EditText
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="170dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:hint="BPM" />
<Button
android:layout_width="70dp"
android:layout_height="30dp"
android:layout_marginLeft="120dp"
android:layout_marginTop="210dp"
android:background="#drawable/rounded_corner"
android:gravity="center"
android:text="save" />
</RelativeLayout>
<View
android:layout_width="316dp"
android:layout_height="117dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="#drawable/sec_temp" />
<View
android:layout_width="316dp"
android:layout_height="117dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="50dp"
android:background="#drawable/sec_temp" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
Try adding elevation inside your header view. like this :
<View
android:layout_width="369dp"
android:layout_height="71dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="13dp"
android:layout_alignParentTop="true"
android:layout_marginTop="14dp"
android:background="#drawable/ic_header"/
android:elevation="1dp">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginStart="25dp"
android:layout_marginTop="25dp"
android:layout_marginEnd="25dp"
android:layout_marginBottom="25dp"
android:text="Record"
android:textAlignment="center"
android:textColor="#color/white"
android:textSize="35sp"
android:elevation="2dp"/>
I set the View elevation 1dp and the TextView 2dp so that the text can still in front of the View.
If anyone could guide me what I am doing wrong in this ? I can't get my items aligned properly.
My list item
And My screen image
Here is my XML of child row. I am binding it with relative layout , then setting fixed length of image and other details are mentioned below. Please have a look. The image isn't appearing in the center as it is supposed to be.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listItem"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:padding="5dp"
android:orientation="vertical">
<ImageView
android:id="#+id/imageView1"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_alignBottom="#+id/Description_txt"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:padding="2dp"
android:src="#drawable/gallery" />
<TextView
android:id="#+id/Name_txt"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/colorPrimaryDark"/>
<TextView
android:id="#+id/Brandname_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Name_txt"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textSize="11sp"
android:textColor="#color/black_overlay"
android:layout_alignRight="#+id/Description_txt"
android:layout_alignEnd="#+id/Description_txt" />
<TextView
android:id="#+id/Description_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Brandname_txt"
android:layout_marginLeft="5dp"
android:textSize="11sp"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textColor="#color/black_overlay" />
<TextView
android:id="#+id/Phone_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/Description_txt"
android:layout_alignBottom="#+id/Description_txt"
android:layout_toEndOf="#+id/Name_txt"
android:layout_toRightOf="#+id/Name_txt"
android:text="#string/arabella"
android:textSize="11sp"
android:textColor="#color/black_overlay" />
<Button
android:id="#+id/View_btn"
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_marginRight="5dp"
android:background="#drawable/btn_view"
android:paddingLeft="5dp"
android:textColor="#android:color/white"
android:textSize="7sp" />
<TextView
android:id="#+id/Viewed_txt"
android:visibility="gone"
android:textSize="11sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/View_btn"
android:layout_alignBottom="#+id/View_btn"
android:layout_marginEnd="25dp"
android:layout_marginRight="25dp"
android:layout_toLeftOf="#+id/View_btn"
android:layout_toStartOf="#+id/View_btn"
android:text="#string/viewed"
android:textStyle="bold"
android:textColor="#color/colorPrimaryDark" />
<ImageView android:id="#+id/imgView"
android:visibility="gone"
android:src="#drawable/ic_small_view"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_toLeftOf="#+id/Viewed_txt"
android:layout_toStartOf="#+id/Viewed_txt"
android:layout_alignBottom="#+id/Name_txt" />
</RelativeLayout>
you can just change the
1 change the height of your list item layout to
android:layout_height="wrap_content"
2 change the gravity of imageView to center
Depending on what layout your using. Use either:
layout_centerVertical="true"
or
gravity="center_vertical"
Also, make the imageView smaller
Use Below XML :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/listItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:padding="5dp">
<ImageView
android:id="#+id/imageView1"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:padding="2dp"
android:src="#drawable/saffron_flag" />
<Button
android:id="#+id/View_btn"
android:layout_width="60dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:background="#drawable/saffron_flag"
android:paddingLeft="5dp"
android:textColor="#android:color/white"
android:textSize="7sp" />
<TextView
android:id="#+id/Name_txt"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="#+id/View_btn"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textColor="#color/colorPrimaryDark"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/Brandname_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Name_txt"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="#+id/View_btn"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textColor="#color/black_overlay"
android:textSize="11sp" />
<TextView
android:id="#+id/Description_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/Brandname_txt"
android:layout_marginLeft="5dp"
android:layout_toLeftOf="#+id/View_btn"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textColor="#color/black_overlay"
android:textSize="11sp" />
<TextView
android:id="#+id/Phone_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginLeft="5dp"
android:layout_below="#+id/Description_txt"
android:layout_toRightOf="#+id/imageView1"
android:text="#string/arabella"
android:textColor="#color/black_overlay"
android:textSize="11sp" />
<TextView
android:id="#+id/Viewed_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/View_btn"
android:layout_alignBottom="#+id/View_btn"
android:layout_marginEnd="25dp"
android:layout_marginRight="25dp"
android:layout_toLeftOf="#+id/View_btn"
android:layout_toStartOf="#+id/View_btn"
android:text="#string/viewed"
android:textColor="#color/colorPrimaryDark"
android:textSize="11sp"
android:textStyle="bold"
android:visibility="gone" />
<ImageView
android:id="#+id/imgView"
android:layout_width="30dp"
android:layout_height="20dp"
android:layout_alignBottom="#+id/Name_txt"
android:layout_toLeftOf="#+id/Viewed_txt"
android:layout_toStartOf="#+id/Viewed_txt"
android:src="#drawable/ic_small_view"
android:visibility="gone" />
</RelativeLayout>
i have this layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#color/black_30">
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:id="#+id/toolbarAnnouncement"
android:theme="#style/ToolBarStyle"
android:elevation="5dp"
android:textAlignment="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_gravity="center"
android:id="#+id/toolbar_title"
android:textSize="20sp"
android:textStyle="bold"
android:background="#00000000"
android:textColor="#ffffff" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="15"
android:id="#+id/channelContainer"
android:orientation="horizontal"
android:layout_below="#+id/toolbarAnnouncement"
android:background="#color/black_30">
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="To :"
android:id="#+id/textView16"
android:textSize="20sp"
android:paddingLeft="5dp"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="11"
android:id="#+id/chipViewLayout"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<com.plumillonforge.android.chipview.ChipView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/buttonChannelSelectorAnnouncement"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="left"
android:padding="5dp"
android:minHeight="90dp" />
</RelativeLayout>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:id="#+id/buttonRemoveChannel"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage1"
android:layout_below="#+id/channelContainer"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach1"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attached."
android:id="#+id/textViewAttach1"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach1"
android:layout_toEndOf="#+id/imageViewAttach1"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remove"
android:id="#+id/buttonAttach1"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach1"
android:layout_above="#+id/textViewAttach1"
android:layout_alignLeft="#+id/textViewAttach1"
android:layout_toLeftOf="#+id/buttonAttach1"
android:layout_toStartOf="#+id/buttonAttach1"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="100" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage2"
android:layout_below="#+id/attacheImage1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach2"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAtttach2"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach2"
android:layout_toEndOf="#+id/imageViewAttach2"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach2"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach2"
android:layout_above="#+id/textViewAtttach2"
android:layout_alignLeft="#+id/textViewAtttach2"
android:layout_toLeftOf="#+id/buttonAttach2"
android:layout_toStartOf="#+id/buttonAttach2"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="77" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage3"
android:layout_below="#+id/attacheImage2"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach3"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/icon_admin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach3"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach3"
android:layout_toEndOf="#+id/imageViewAttach3"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach3"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach3"
android:layout_above="#+id/textViewAttach3"
android:layout_alignLeft="#+id/textViewAttach3"
android:layout_toLeftOf="#+id/buttonAttach3"
android:layout_toStartOf="#+id/buttonAttach3"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="43" />
</RelativeLayout>
<EditText
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:ems="10"
android:fitsSystemWindows="true"
android:id="#+id/editText"
android:hint="write from here..."
android:gravity="top"
android:padding="5dp"
android:layout_above="#+id/relativeLayout4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="#+id/attacheImage3"
android:background="#ffffff" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="#color/button_material_light"
android:id="#+id/relativeLayout4">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Image"
android:id="#+id/buttonAddImage"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Send"
android:id="#+id/button2"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
and in my layout when i start editing my editText every other layout moves up with keyboard but not the layout that is on bottom(with 2 buttons), i want it to move up too , so that it can be visible while editing my editText
any idea how i can i do this ?? my manifest for my activity :
<activity android:name=".myActivity"
android:theme="#style/AppTheme.NoActionBar"/>
what i actually need looks like this :
SEE THAT THING ON THE BOTTOM IN IOS WE CALL IT INPUT ACCESSORY
and when editing starts :
THAT LAYOUT MOVES UP WITH KEYBOARD
and what i have is this :
and when editing starts :
Try to use that new XML Layout File:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="#color/black_30">
<android.support.v7.widget.Toolbar
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:id="#+id/toolbarAnnouncement"
android:elevation="5dp"
android:theme="#style/ToolBarStyle"
android:textAlignment="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_gravity="center"
android:id="#+id/toolbar_title"
android:textSize="20sp"
android:textStyle="bold"
android:background="#00000000"
android:textColor="#ffffff" />
</android.support.v7.widget.Toolbar>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:weightSum="15"
android:id="#+id/channelContainer"
android:orientation="horizontal"
android:layout_below="#+id/toolbarAnnouncement"
android:background="#color/black_30"
android:layout_weight="0.20">
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="To :"
android:id="#+id/textView16"
android:textSize="20sp"
android:paddingLeft="5dp"
android:layout_gravity="center_vertical" />
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="11"
android:id="#+id/chipViewLayout"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingTop="10dp">
<com.plumillonforge.android.chipview.ChipView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/buttonChannelSelectorAnnouncement"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:gravity="left"
android:padding="5dp"
android:minHeight="90dp" />
</RelativeLayout>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:id="#+id/buttonRemoveChannel"
android:background="#android:drawable/ic_menu_close_clear_cancel"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage1"
android:layout_below="#+id/channelContainer"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach1"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/location" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attached."
android:id="#+id/textViewAttach1"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach1"
android:layout_toEndOf="#+id/imageViewAttach1"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remove"
android:id="#+id/buttonAttach1"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach1"
android:layout_above="#+id/textViewAttach1"
android:layout_alignLeft="#+id/textViewAttach1"
android:layout_toLeftOf="#+id/buttonAttach1"
android:layout_toStartOf="#+id/buttonAttach1"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="100" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage2"
android:layout_below="#+id/attacheImage1"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach2"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#android:drawable/sym_def_app_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAtttach2"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach2"
android:layout_toEndOf="#+id/imageViewAttach2"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach2"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach2"
android:layout_above="#+id/textViewAtttach2"
android:layout_alignLeft="#+id/textViewAtttach2"
android:layout_toLeftOf="#+id/buttonAttach2"
android:layout_toStartOf="#+id/buttonAttach2"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="77" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/attacheImage3"
android:layout_below="#+id/attacheImage2"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#ffffff"
android:visibility="gone">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:id="#+id/imageViewAttach3"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:background="#ffffff"
android:src="#drawable/icon_admin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Attaching..."
android:id="#+id/textViewAttach3"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/imageViewAttach3"
android:layout_toEndOf="#+id/imageViewAttach3"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:id="#+id/buttonAttach3"
android:layout_alignParentTop="false"
android:layout_alignParentRight="true" />
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/progressBarAttach3"
android:layout_above="#+id/textViewAttach3"
android:layout_alignLeft="#+id/textViewAttach3"
android:layout_toLeftOf="#+id/buttonAttach3"
android:layout_toStartOf="#+id/buttonAttach3"
android:layout_marginRight="5dp"
android:indeterminate="false"
android:progress="43" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.70">
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:inputType="textMultiLine"
android:fitsSystemWindows="true"
android:id="#+id/editText"
android:hint="write from here..."
android:gravity="top"
android:padding="5dp"
android:background="#ffffff"
android:ems="10"
android:layout_weight="0.80"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#color/button_material_light"
android:id="#+id/relativeLayout4">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Image"
android:id="#+id/buttonAddImage"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:text="Send"
android:id="#+id/button2"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
This is because of you set android:layout_alignParentBottom="true" to relativeLayout4 this won't allow it to scroll upwards. Set Top margin according to your needs or Take Linearlayout and adjust layout by weightsum property and layout_weight property.
I have created a layout with edit boxes ,textfields,buttons and images etc. But when i try to type something in my edit box the keyboard appears and my layout changes horribly .how can i fix this?
before keyboard appears
after keyboard appears
my layout
<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="#color/grey"
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=".MainActivity" >
<TextView
android:id="#+id/contactus_heading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/cinema_contactus"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20dp" />
<EditText
android:id="#+id/contactus_name_edittext"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_above="#+id/contactus_email_edittext"
android:layout_alignLeft="#+id/contactus_email_edittext"
android:layout_alignRight="#+id/contactus_email_edittext"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="#drawable/rounded_edittext"
android:ems="10"
android:hint="Name"
android:textSize="12sp" />
<EditText
android:id="#+id/contactus_email_edittext"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_above="#+id/contactus_message_edittext"
android:layout_marginBottom="20dp"
android:layout_toRightOf="#+id/fax"
android:background="#drawable/rounded_edittext"
android:ems="10"
android:hint="E-mail"
android:textSize="12sp" />
<EditText
android:id="#+id/contactus_message_edittext"
android:layout_width="340dp"
android:layout_height="115dp"
android:layout_above="#+id/contactus_submit_button"
android:layout_alignLeft="#+id/contactus_email_edittext"
android:layout_alignRight="#+id/contactus_email_edittext"
android:layout_marginBottom="20dp"
android:background="#drawable/rounded_edittext"
android:ems="10"
android:gravity="top|left"
android:hint="Message"
android:textSize="12sp" />
<Button
android:id="#+id/contactus_submit_button"
android:layout_width="125dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/mybutton"
android:text="#string/submit"
android:layout_marginBottom="30dp"
android:layout_marginTop="20dp"
android:textSize="14dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
<ImageView
android:id="#+id/emailedit"
android:layout_width="45dp"
android:layout_height="40dp"
android:layout_alignTop="#+id/contactus_email_edittext"
android:layout_toLeftOf="#+id/contactus_email_edittext"
android:src="#drawable/emailtop" />
<ImageView
android:id="#+id/nameedit"
android:layout_width="45dp"
android:layout_height="40dp"
android:layout_alignTop="#+id/contactus_name_edittext"
android:layout_toLeftOf="#+id/contactus_name_edittext"
android:src="#drawable/nametop" />
<ImageView
android:id="#+id/messageedit"
android:layout_width="45dp"
android:layout_height="115dp"
android:layout_alignTop="#+id/contactus_message_edittext"
android:layout_toLeftOf="#+id/contactus_message_edittext"
android:src="#drawable/messagetop" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/contactus_submit_button"
android:layout_below="#+id/contactus_email_edittext"
android:orientation="horizontal" >
</LinearLayout>
<ImageView
android:id="#+id/fax"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignTop="#+id/contactus_telephone2"
android:layout_toLeftOf="#+id/contactus_telephone2"
android:layout_marginTop="3dp"
android:src="#drawable/fax" />
<ImageView
android:id="#+id/email"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignTop="#+id/contactus_email"
android:layout_toLeftOf="#+id/contactus_email"
android:layout_marginTop="3dp"
android:src="#drawable/message" />
<ImageView
android:id="#+id/telephone"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignTop="#+id/contactus_telephone1"
android:layout_toLeftOf="#+id/contactus_telephone1"
android:layout_marginTop="3dp"
android:src="#drawable/call" />
<ImageView
android:id="#+id/addresspointer"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignLeft="#+id/telephone"
android:layout_alignTop="#+id/contactus_address"
android:layout_marginTop="3dp"
android:src="#drawable/pointer" />
<TextView
android:id="#+id/contactus_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/contactus_submit_button"
android:layout_centerHorizontal="true"
android:text="#string/cinema_contactus_address"
android:textColor="#000000"
android:lineSpacingExtra="5dp"
android:textSize="14sp"
android:layout_marginTop="25dp" />
<TextView
android:id="#+id/contactus_telephone1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/contactus_address"
android:layout_below="#+id/contactus_address"
android:text="#string/cinema_contactus_telephone1"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:textSize="14sp" />
<TextView
android:id="#+id/contactus_telephone2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/telephone"
android:layout_toRightOf="#+id/telephone"
android:text="#string/cinema_contactus_telephone2"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:textSize="14sp" />
<TextView
android:id="#+id/contactus_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/contactus_telephone2"
android:layout_below="#+id/contactus_telephone1"
android:text="#string/cinema_contactus_email"
android:textColor="#000000"
android:layout_marginTop="5dp"
android:textSize="14sp" />
</RelativeLayout>
try this
inside onCreate write
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Ok found the answer
i just had to add the following in my activity in manifest
android:windowSoftInputMode="adjustPan"
In my app am using customized listed view with text view and Buttons.The screen size is 4.65" 720p(720X1280 : xhdpi),device take this resolution from layout-large folder.when i run it on device.the list view item and header display not fit to the screen like image shown below,some empty space in the end of row.Its not able to fit to the screen.Can any one know please help me to solve this issue.
Header XML Coding
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/search_lay"
android:layout_marginTop="1dp"
android:background="#e8e8e8" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="32dp"
android:text="Item(s)"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="48dp"
android:layout_toRightOf="#+id/textView1"
android:text="Price(Rs.)"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:layout_toRightOf="#+id/textView3"
android:text="Qty"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="28dp"
android:layout_toRightOf="#+id/textView2"
android:text="Total(Rs.)"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:text="Fav"
android:textColor="#dd1713"
android:textSize="13sp" />
</RelativeLayout>
Customized List-view XML Coding
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#ffffff" >
<TextView
android:id="#+id/orderlist_product_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:visibility="gone" />
<RelativeLayout
android:layout_width="30dp"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/fav_img"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="#drawable/fav_order_list_btn" />
<Button
android:id="#+id/special_inst_btn"
android:layout_width="25dp"
android:layout_height="18dp"
android:layout_below="#+id/fav_img"
android:layout_centerHorizontal="true"
android:background="#drawable/special_inst_btn_in_orderlist"
android:gravity="center"
android:text="+"
android:textColor="#ffffff"
android:textSize="14sp" />
</RelativeLayout>
<TextView
android:id="#+id/order_list_itemname"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="1dp"
android:text="Item name"
android:textColor="#000000"
android:textSize="12sp"
android:typeface="serif" />
<RelativeLayout
android:layout_width="34dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp" >
<TextView
android:id="#+id/orderlist_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:gravity="center"
android:textColor="#298616"
android:textSize="10sp" />
<TextView
android:id="#+id/orderlist_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="right"
android:text="200.00"
android:textColor="#000000"
android:textSize="10sp"
android:typeface="serif" />
</RelativeLayout>
<Button
android:id="#+id/orderlist_minus"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginTop="1dp"
android:background="#drawable/sub_button_click" />
<EditText
android:id="#+id/order_list_quantity"
android:layout_width="27dp"
android:layout_height="25dp"
android:layout_marginTop="13dp"
android:background="#drawable/et_bg"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center"
android:inputType="number"
android:textColor="#000000"
android:textSize="12dp"
android:typeface="serif" >
<requestFocus />
</EditText>
<Button
android:id="#+id/orderlist_plus"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginTop="1dp"
android:background="#drawable/plus_btn_click" />
<TextView
android:id="#+id/orderlist_total"
android:layout_width="43dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginTop="13dp"
android:gravity="right"
android:text="1000.00"
android:textColor="#000000"
android:textSize="11sp"
android:typeface="serif" />
<Button
android:id="#+id/orderlist_delete"
android:layout_width="23dp"
android:layout_height="23dp"
android:layout_gravity="center"
android:layout_marginLeft="3dp"
android:layout_marginTop="1dp"
android:background="#drawable/order_list_delete" />
</LinearLayout>
</RelativeLayout>
i m giving u a demo.this layout will work on all size layout,this will definitely help u #Yugesh.
weight works percentage-wise on all screen.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".30"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/image1"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".30"
android:text="30%" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".20"
android:text="20%" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".20"
android:text="20%" />
</LinearLayout>
</RelativeLayout>
further more,if there is any query,then please ask...