I want to change text of Textview dynamically,
but it does not show full text.instead it shw one or two character less than it or sometimes show "...." atlast.
This is a layout for an custom equalizer.
This is my xml file.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/fullscreenlnearlayout"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.38"
android:gravity="center" >
<Button
android:id="#+id/btnformenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:text="Create New..." />
<ImageButton
android:id="#+id/refresh"
android:contentDescription="Reset Equalizer to Default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_margin="20dp"
android:adjustViewBounds="false"
android:alpha=".4"
android:src="#drawable/refresh"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ToggleButton
android:id="#+id/exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/refresh"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:alpha=".4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:id="#+id/horizontalscrollforequaliser"
android:layout_height="0dp"
android:isScrollContainer="false"
android:layout_weight="1">
<TextView
android:id="#+id/seekbar1kabottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="60Hz" />
<include
android:id="#+id/include5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekbar1kabottom"
android:layout_alignTop="#+id/include7"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_centerHorizontal="true"
layout="#layout/eq_bar" />
<TextView
android:id="#+id/seekbar3katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:singleLine="true"
android:text="0mB" />
<TextView
android:id="#+id/seekbar3kabottom"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="910Hz" />
<include
android:id="#+id/include7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekbar3kabottom"
android:layout_alignParentLeft="true"
android:layout_below="#+id/seekbar3katop"
layout="#layout/eq_bar" />
<include
android:id="#+id/include"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekbar5kabottom"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/include4"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
layout="#layout/eq_bar" />
<include
android:id="#+id/include4"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/include5"
android:layout_alignTop="#+id/include6"
android:layout_toStartOf="#+id/include"
android:layout_toLeftOf="#+id/include"
layout="#layout/eq_bar" />
<TextView
android:id="#+id/seekbar4katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include4"
android:layout_alignStart="#+id/include4"
android:layout_alignEnd="#+id/seekbar4kabottom"
android:layout_alignLeft="#+id/include4"
android:layout_alignRight="#+id/seekbar4kabottom"
android:singleLine="false"
android:text="0mB"/>
<TextView
android:id="#+id/seekbar5kabottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:singleLine="true"
android:layout_below="#+id/include4"
android:text="14KHz" />
<TextView
android:id="#+id/seekbar4kabottom"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/include4"
android:layout_alignLeft="#+id/include4"
android:layout_below="#+id/include4"
android:text="3600Hz" />
<TextView
android:id="#+id/seekbar2kabottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/include6"
android:layout_alignParentBottom="true"
android:singleLine="true"
android:text="230Hz" />
<TextView
android:id="#+id/seekbar2katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include6"
android:layout_alignEnd="#+id/seekbar2kabottom"
android:layout_alignLeft="#+id/include6"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/seekbar2kabottom"
android:singleLine="false"
android:text="0mB" />
<include
android:id="#+id/include6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/include7"
android:layout_below="#+id/seekbar1katop"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/include7"
layout="#layout/eq_bar" />
<TextView
android:id="#+id/seekbar5katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include"
android:layout_alignLeft="#+id/seekbar5kabottom"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignStart="#+id/include"
android:singleLine="false"
android:text="0mB" />
<TextView
android:id="#+id/seekbar1katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/include7"
android:singleLine="false"
android:text="0mB" />
</RelativeLayout>
</LinearLayout>
In picture you can see text s not coming u fully....it is not showing mB (unit) atlast.
I am trying this from several hours,but unable to do this
Please give me a way to achieve this .
Thans in advance :)
You can decrease the text size of the TextView and see the changes. Ideally Android design guidelines specify that you create separate layouts for different screen sizes and resolutions. So on some devices the TextView font size would just fit fine but for others it'd have to be adjusted
You can decrease Text size of the TextView .
If you want remove .... You can remove this line
android:singleLine="true"
and set width as match_parent or fill_parent .
Remove wrap content and set a size using dp, it will probably work
Related
I have just created an expandable RecyclerView with different views as every parent item have a child My case is when expanding parent item it view it's child with a vertical spacing between each child Item like this
as this is my main XML File
<?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:background="#dedede"
tools:context="abtech.waiteriano.com.waitrer.MainPaymentActivity">
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="19dp"
android:background="#ffffff">
<EditText
android:id="#+id/checkNoET"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/imageView7"
android:editable="false"
android:ems="10"
android:gravity="right"
android:text="505050505050"
android:textSize="12dp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/checkNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/checkNoET"
android:layout_alignBottom="#+id/checkNoET"
android:layout_marginStart="10dp"
android:layout_toEndOf="#+id/imageView7"
android:text="Check#"
android:textColor="#color/colorPrimary"
android:textSize="12dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView7"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/checkNoET"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/checkNoET"
app:srcCompat="#drawable/check" />
<EditText
android:id="#+id/editText"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/checkNoET"
android:layout_alignBottom="#+id/checkNoET"
android:layout_alignParentEnd="true"
android:editable="false"
android:ems="10"
android:gravity="end"
android:text="5"
android:textSize="12dp">
<requestFocus />
</EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText"
android:layout_alignBottom="#+id/editText"
android:layout_alignStart="#+id/editText"
android:layout_marginStart="13dp"
android:text="Coves"
android:textColor="#color/colorPrimary"
android:textSize="12dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView8"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText"
android:layout_toStartOf="#+id/editText"
app:srcCompat="#drawable/covers" />
<EditText
android:id="#+id/tableNo"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_below="#+id/checkNoET"
android:layout_toEndOf="#+id/imageView7"
android:editable="false"
android:ems="10"
android:gravity="end"
android:text="25"
android:textSize="12dp">
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/tableNo"
android:layout_alignBottom="#+id/tableNo"
android:layout_alignStart="#+id/checkNo"
android:text="Table"
android:textColor="#color/colorPrimary"
android:textSize="12dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView9"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/checkNoET"
app:srcCompat="#drawable/tablepay" />
<EditText
android:id="#+id/editText14"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/tableNo"
android:layout_alignBottom="#+id/tableNo"
android:layout_alignParentEnd="true"
android:editable="false"
android:text="15/10/2017 03:15PM"
android:textColor="#000000"
android:textSize="10dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView10"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText14"
android:layout_toStartOf="#+id/editText14"
app:srcCompat="#drawable/calendar" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/relativeLayout2"
android:layout_marginTop="14dp"
android:background="#ffffff">
<android.support.v7.widget.RecyclerView
android:id="#+id/parentList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="220dp"
android:layout_below="#+id/relativeLayout3"
android:layout_marginTop="10dp"
android:background="#ffffff">
<GridView
android:id="#+id/paymentsTypeGV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnWidth="80dp"
android:gravity="center"
android:horizontalSpacing="5dp"
android:numColumns="4"
android:stretchMode="columnWidth"
android:verticalSpacing="5dp"></GridView>
</RelativeLayout>
</RelativeLayout>
my problem is from my xml design and if i is from xml design the problem is in the parent list item ot the child list item or from the main XML File sorry if any thing is not clear enough
Here's a thought: try removing any padding on the text elements.
android:includeFontPadding="false"
If this works, then this answer will become duplicate to:
Android: TextView: Remove spacing and padding on top and bottom
I have a relative layout where i already aligned almost all elements like i want, but there are two elements at the right bottom(textView and the icon of forbiden photo), they are aligned related to the parent, the parent is not the photo.
I want to align those elements to the bottom of the image that i have:
here is a
expected results:
the rectangle is where i want the textView and the camera forbiden icon!
and here is the xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="142dp"
android:layout_gravity="center"
android:layout_margin="#dimen/card_margin"
android:elevation="3dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
card_view:cardCornerRadius="#dimen/card_specie_radius">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.example.afcosta.inesctec.pt.android.Helpers.NexusBoldTextView
android:id="#+id/Avaliation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/plantName"
android:layout_marginStart="92dp"
android:layout_marginTop="15dp"
android:text="Avalie a fotografia" />
<com.example.afcosta.inesctec.pt.android.Helpers.NexusBoldTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/plantPhoto"
android:textColor="#color/base"
android:layout_marginTop="4dp"
android:layout_toStartOf="#+id/cameraForbiden"
android:text="TextView" />
<ImageView
android:id="#+id/reportImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/color_cursor_white" />
<ImageView
android:id="#+id/plantPhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp" />
<ImageView
android:id="#+id/userIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentBottom="true"
android:layout_below="#id/plantPhoto"
android:src="#drawable/ic_user"
/>
<com.example.afcosta.inesctec.pt.android.Helpers.NexusBoldTextView
android:id="#+id/plantName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/plantPhoto"
android:textColor="#color/nephritis"
android:textSize="18sp" />
<ImageView
android:id="#+id/starIcon"
android:layout_width="23dp"
android:layout_height="23dp"
android:layout_alignParentTop="true"
android:layout_toRightOf="#+id/plantName"
android:src="#drawable/ic_star"
android:layout_marginLeft="10dp"
/>
<ImageView
android:id="#+id/cameraForbiden"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_toRightOf="#+id/plantName"
android:layout_marginLeft="10dp"
android:src="#drawable/ic_no_photos"
android:layout_below="#id/plantPhoto"
/>
<com.example.afcosta.inesctec.pt.android.Helpers.NexusBoldTextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/plantPhoto"
android:textColor="#color/base"
android:layout_marginEnd="29dp"
android:layout_marginTop="8dp"
android:layout_toEndOf="#+id/userIcon"
android:layout_toLeftOf="#+id/userIcon"
android:paddingLeft="10px"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
Use following code:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/plantPhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/userIcon"
android:layout_width="15dp"
android:layout_height="15dp"
android:src="#drawable/ic_user"
/>
<com.example.afcosta.inesctec.pt.android.Helpers.NexusBoldTextView
android:id="#+id/plantName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/nephritis"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
I have the following xml layout but my scrollview is not scrolling when I run the app. What am I doing wrong? I am trying to use a Relative layout in the scrollview instead of a Linear Layout Here is the xml..
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/main_title"
android:textSize="30sp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="180dp"
android:layout_height="270dp"
android:id="#+id/movie_poster"
android:layout_weight="0.59"
android:layout_below="#+id/main_title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Ratings:"
android:id="#+id/textView"
android:layout_alignTop="#+id/movie_poster"
android:layout_toRightOf="#+id/movie_poster"
android:layout_toEndOf="#+id/movie_poster"
android:layout_marginLeft="52dp"
android:layout_marginStart="52dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=" 6.5"
android:textStyle="bold"
android:id="#+id/movie_rating"
android:layout_alignTop="#+id/textView"
android:layout_toRightOf="#+id/textView"
android:layout_toEndOf="#+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=" 2015-01-01"
android:textStyle="bold"
android:id="#+id/movie_release_date"
android:layout_below="#+id/textView"
android:layout_alignLeft="#+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="180dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/movie_description"
android:layout_below="#+id/movie_poster"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</ScrollView>
That is because you set the height of the ScrollView to fill_parent.
Try using a LinearLayout with weight so it fills the space left over from the other views.
If you do not want to set it to a specific height, you can also add
android:fillViewport="true"
to your ScrollView
My items on large screen like 10.1 works fine and every item in its position but if I change the screen to 4 or 3, some of my items disappear and some appear in large font related to the device screen, so I want it to appear all items on its correct positions so if the app run on small screen the font small and every thing in its normal position, also with large screen. So what I have to do to my xml to get my goal?
this is my xml :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="false"
android:fadingEdge="none"
android:background="#BFAF80"
android:scrollbars="none"
android:scrollbarSize="0dp"
android:paddingRight="0dp"
android:scrollbarAlwaysDrawVerticalTrack="false"
android:scrollbarStyle="insideOverlay"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#BFAF80"
android:id="#+id/CreatClear"
android:orientation="vertical">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/Bwt"
android:textStyle="bold"
android:gravity="center"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="29dp"
android:hint="#string/body_weight"
android:textColor="#e53f3f3f" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/Age"
android:textStyle="bold"
android:gravity="center"
android:hint="#string/age_years"
android:layout_below="#+id/Hit"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#e53f3f3f" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/Screat"
android:gravity="center"
android:textStyle="bold"
android:hint="#string/serum_creatinine"
android:layout_below="#+id/Age"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#e53f3f3f" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female"
android:id="#+id/Cfemale"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:textSize="#dimen/abc_text_size_medium_material"
android:layout_marginTop="28dp"
android:layout_below="#+id/Screat"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male"
android:id="#+id/Cmale"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:textSize="#dimen/abc_text_size_medium_material"
android:layout_below="#+id/Cfemale"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="64dp"
android:layout_height="64dp"
android:id="#+id/calcH"
android:background="#drawable/ic_launcher5"
android:clickable="false"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<TextView
android:layout_width="64dp"
android:layout_height="64dp"
android:id="#+id/calc"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#drawable/ic_launcher"
android:clickable="true"
android:gravity="center" />
<TextView
android:layout_width="48dp"
android:layout_height="48dp"
android:text="Reset"
android:id="#+id/clearH"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:background="#drawable/ic_launcher5"
android:clickable="false"
android:gravity="center"
android:layout_alignBottom="#+id/sex"
android:layout_toLeftOf="#+id/sexa1"
android:layout_toStartOf="#+id/sexa1" />
<TextView
android:layout_width="48dp"
android:layout_height="48dp"
android:text="Reset"
android:id="#+id/clear"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:background="#drawable/ic_launcher3"
android:clickable="true"
android:gravity="center"
android:layout_alignTop="#+id/clearH"
android:layout_alignLeft="#+id/clearH"
android:layout_alignStart="#+id/clearH" />
<TextView
android:layout_width="48dp"
android:layout_height="48dp"
android:text="Menu"
android:id="#+id/menuH"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:background="#drawable/ic_launcher5"
android:clickable="false"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/sex"
android:layout_toEndOf="#+id/sex" />
<TextView
android:layout_width="48dp"
android:layout_height="48dp"
android:text="Menu"
android:id="#+id/menu"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:background="#drawable/ic_launcher3"
android:clickable="true"
android:gravity="center"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/sex"
android:layout_toEndOf="#+id/sex" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/Hit"
android:textStyle="bold"
android:gravity="center"
android:hint="#string/height_cm"
android:layout_below="#+id/Bwt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#e53f3f3f"/>
<TextView
style="#style/TextAppearance.AppCompat.Medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/Serum"
android:gravity="center"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:textSize="#dimen/abc_text_size_large_material"
android:lines="#integer/abc_max_action_buttons"
android:autoText="false"
android:background="#color/ripple_material_dark"
android:layout_above="#+id/blank"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
style="#style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/newSerum"
android:gravity="center"
android:textColor="#e53f3f3f"
android:textStyle="bold"
android:textSize="#dimen/abc_text_size_large_material"
android:layout_above="#+id/calcH"
android:layout_centerHorizontal="true"
android:visibility="visible"
android:lines="#integer/abc_max_action_buttons"
android:background="#color/ripple_material_dark" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="nIBW"
android:id="#+id/nIBW"
android:layout_below="#+id/Cmale"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="34dp"
android:visibility="invisible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="nABW"
android:id="#+id/nABW"
android:layout_alignBottom="#+id/nIBW"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="invisible" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/sex"
android:layout_alignTop="#+id/Cfemale"
android:layout_toRightOf="#+id/Screat"
android:layout_toEndOf="#+id/Screat"
android:gravity="center"
android:text="Gender"
android:visibility="invisible"
android:layout_alignParentLeft="true"
android:layout_marginLeft="0dp"
android:layout_alignParentTop="true"
android:layout_marginTop="604dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/sexa1"
android:gravity="center"
android:text="Gender1"
android:visibility="invisible"
android:layout_alignTop="#+id/Cfemale"
android:layout_alignRight="#+id/nIBW"
android:layout_alignEnd="#+id/nIBW" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/sexa2"
android:gravity="center"
android:text="Gender2"
android:visibility="invisible"
android:layout_alignTop="#+id/sexa1"
android:layout_alignRight="#+id/sexa1"
android:layout_alignEnd="#+id/sexa1" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="#+id/BSA"
android:gravity="center"
android:text="Body Surface Area"
android:visibility="invisible"
android:layout_below="#+id/Cmale"
android:layout_toLeftOf="#+id/nABW"
android:layout_toStartOf="#+id/nABW" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="#+id/blank"
android:layout_above="#+id/newSerum"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
style="#style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Creat Clear (ml/min)"
android:id="#+id/HSerum"
android:gravity="center"
android:textColor="#ffffffff"
android:textStyle="bold"
android:background="#color/background_material_dark"
android:textSize="#dimen/abc_text_size_large_material"
android:layout_alignTop="#+id/BSA"
android:layout_toRightOf="#+id/Screat"
android:layout_toEndOf="#+id/Screat"
android:visibility="invisible" />
</RelativeLayout>
</ScrollView>
Create a some resource directories called values-swXXXdp in res folder where XXX means smallest screen witdh.
In each directory create a file called dimens.xml and define the dimension for each swXXXdp:
<dimen name="custom_width">40dp</dimen>
Then, to retrieve that value in xml do the following: for example the width of a view:
android:layout_width="#dimen/custom_width"
I have this layout
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/comments_list" android:layout_gravity="center"
android:layout_below="#+id/phone_editText" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_above="#+id/bottom_container"
android:layout_alignRight="#+id/search_btn" android:layout_alignEnd="#+id/search_btn"/>
<AutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/phone_editText"
android:hint="enter phone"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="blocked"
android:id="#+id/isBlocked_cb"
android:layout_toStartOf="#+id/phone_editText"
android:layout_toLeftOf="#+id/phone_editText"
android:layout_above="#+id/comments_list"
android:checked="true" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="search"
android:id="#+id/search_btn"
android:layout_toEndOf="#+id/phone_editText"
android:layout_toRightOf="#+id/phone_editText"
android:layout_above="#+id/comments_list"
android:layout_alignParentTop="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:onClick="foo"/>
<RelativeLayout android:id="#+id/bottom_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<AutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/comment_text"
android:hint="enter comment"
android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"/>
<Button style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Add" android:id="#+id/add_btn"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/comment_text" android:layout_alignTop="#+id/comment_text"/>
</RelativeLayout>
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"/>
</RelativeLayout>
I want bottom_container to be below my ListView
but in the simulator they seems one above the other:
Your question it's pretty incomplete, but I see some potential error in your xml about "above"
For example
android:layout_above="#+id/comments_list"
android:layout_alignParentTop="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:onClick="foo"/>
This is an error, you can not declare align parent top and end togheter... and in any case, If I'm right, those ovverride layout_above.