Metro layout align bottom - android

I'am working on a metro-ish layout for android, but i can seem to make it work the same on all devices. On a Galaxy Note3 it doesn't align to the bottom (too much gap between buttons), and on a smaller screen Galaxy Ace2 it fits too crowded (some buttons next to each other)
This is my layout, any ideas on how to make it universal would be great! Thanks in advance
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/bg_login" >
<ImageView
android:id="#+id/icon_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:src="#drawable/logo_white" />
<Button
android:id="#+id/btn_feed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/gradient_feed"
android:drawableTop="#drawable/feed"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Feed"
android:textColor="#color/white"
android:textSize="10dip" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<Button
android:id="#+id/btn_profile"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_profile"
android:drawableTop="#drawable/profile"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Profile"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_new_challenge"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_new_challenge"
android:drawableTop="#drawable/new_challenge"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="New Challenge"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_rankings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="#drawable/gradient_rankings"
android:drawableTop="#drawable/rankings"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Rankings"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<Button
android:id="#+id/btn_factory"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_factory"
android:drawableTop="#drawable/task_factory"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Task Factory"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_settings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_settings"
android:drawableTop="#drawable/settings"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Settings"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_gadgets"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="#drawable/gradient_gadgets"
android:drawableTop="#drawable/gadgets"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Gadgets"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
</LinearLayout>
<Button
android:id="#+id/btn_store"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/gradient_store"
android:drawableTop="#drawable/store"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Store"
android:textColor="#color/white"
android:textSize="10dip" />
<Button
android:id="#+id/btn_help"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/gradient_help"
android:drawableTop="#drawable/help"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Help"
android:textColor="#color/white"
android:textSize="10dip" />
</LinearLayout>

To have content that takes the whole space height you will have to play with the weight of your child Views and their respective height.
I don't get where is your first image icon_photo. Doesn't look to be in your screenshots.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/bg_login" >
<ImageView
android:id="#+id/icon_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:src="#drawable/logo_white" />
<Button
android:id="#+id/btn_feed"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="10dp"
android:background="#drawable/gradient_feed"
android:drawableTop="#drawable/feed"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Feed"
android:textColor="#color/white"
android:textSize="10dip" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<Button
android:id="#+id/btn_profile"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_profile"
android:drawableTop="#drawable/profile"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Profile"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_new_challenge"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_new_challenge"
android:drawableTop="#drawable/new_challenge"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="New Challenge"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_rankings"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:background="#drawable/gradient_rankings"
android:drawableTop="#drawable/rankings"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Rankings"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<Button
android:id="#+id/btn_factory"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_factory"
android:drawableTop="#drawable/task_factory"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Task Factory"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_settings"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:background="#drawable/gradient_settings"
android:drawableTop="#drawable/settings"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Settings"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
<Button
android:id="#+id/btn_gadgets"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:background="#drawable/gradient_gadgets"
android:drawableTop="#drawable/gadgets"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Gadgets"
android:textColor="#color/white"
android:textSize="10dip"
android:layout_weight="1.00" />
</LinearLayout>
<Button
android:id="#+id/btn_store"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/gradient_store"
android:drawableTop="#drawable/store"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Store"
android:textColor="#color/white"
android:textSize="10dip" />
<Button
android:id="#+id/btn_help"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/gradient_help"
android:drawableTop="#drawable/help"
android:gravity="center|center_vertical"
android:padding="10dp"
android:text="Help"
android:textColor="#color/white"
android:textSize="10dip"
/>
</LinearLayout>
The difference between those screen is high. You will maybe have to play with different layouts or different box sizes using the values but if your drawables size are not the same you can probably deal without having multiple layouts.
http://developer.android.com/guide/practices/screens_support.html

I would create different layout folders for different resolution, density. I wouldn't just use one xml for all different phone sizes out there. You probably want to pick out the most popular ones and just aim for those.

Related

How do I prevent one TextView from pushing the other out of the screen?

[SOLVED] Marked the working solution. #GIBIN THOMAS: this suggestion works as well (similar).
Below I've posted an issue which arise when the Scoring increases, making it to expand and therefor push the other TextView out of the screen. I've tried changing the Width and height in all kinds of ways for both the TextViews themselves and the Layout that's wrapping them, without any luck.
PROBLEM: Anyone got a good solution how to set my Layout and/or TextViews width and height to prevent the Scoring TextView from pushing the Lives TextView out of the screen?
.
This is my XML-file:
The layout & textviews below are all inside another layout (including 4 buttons, one imageview and another textView - excluded in the code)
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/currentScoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:text="#string/current_score"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentScoreEasy"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/current_score_0"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="205dp"
android:layout_marginStart="205dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="#+id/lives"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:gravity="center"
android:text="#string/lives"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentLivesEasy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/lives_5"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
Try this layout:
use android:weightSum and android:layout_weight properly
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="horizontal"
android:weightSum="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal"
android:padding="10dp">
<TextView
android:id="#+id/currentScoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:text="SCORE"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentScoreEasy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SCORE"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="horizontal"
android:padding="10dp">
<TextView
android:id="#+id/lives"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:gravity="center"
android:text="Lives"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentLivesEasy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lives"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
Output:
This will fix your issue
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/currentScoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:text="Current Score"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentScoreEasy"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Scrore"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/lives"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:gravity="center"
android:text="Lives"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentLivesEasy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lives 5"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
Please remove the strings i have added also if you have further doubts feel free to note down below
Please make sure to apply proper weight and other changes as follows :
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:orientation="horizontal"
android:padding="10dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:orientation="horizontal">
<TextView
android:id="#+id/currentScoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:text="current_score"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentScoreEasy"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_height="wrap_content"
android:text="current_score_0"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:orientation="horizontal">
<TextView
android:id="#+id/lives"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:gravity="center"
android:text="lives"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentLivesEasy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lives_5"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
Just give the LinearLayout , layout_weight="5" .. Like
android:layout_weight="3" and make the android:layout_width = "0px"
Note="Set the layout weight according to your spacing" ...
The Linear Layout in which u have fitted these two textviews
Simply replace your current score linear layout with this relative layout and you are done.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/currentScoreText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_marginRight="2dp"
android:layout_alignParentLeft="true"
android:text="current_score"
android:textColor="#android:color/black"
android:textSize="20sp" />
<TextView
android:id="#+id/currentScoreEasy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="current_score_0"
android:textColor="#android:color/holo_red_dark"
android:textSize="20sp" />
</RelativeLayout>

android Layout Spacing

I'm new to Android dev so sorry for what is probably a basic question....
I'm trying to get 2 textviews to appear at the top of the screen and take up an equal amount of space each BUT to have a margin of say 20dp between the 2 views and on the left and the right hand side of the screen.
Much like
My code currently is:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:orientation="horizontal">
<TextView
android:id ="#+id/1_Heading"
android:text="1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:id ="#+id/2_Heading"
android:text="2"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
</LinearLayout>
Any ideas and sorry if this is a basic question - I've tried to find a solution online but nothing much helps.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:weightSum="2"
android:orientation="horizontal">
<TextView
android:id ="#+id/1_Heading"
android:text="1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
<TextView
android:id ="#+id/2_Heading"
android:text="2"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
</LinearLayout>
You just need to give half right margin to your first Textview and half left margin to your second Textview as below:-
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:orientation="horizontal">
<TextView
android:id ="#+id/1_Heading"
android:text="1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp" />
<TextView
android:id ="#+id/2_Heading"
android:text="2"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
</LinearLayout>
you can handle this with giving a 20dp padding to parent (LinearLayout) and then 10dp margin from end to the first button, and 10dp margint from start to the second button.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:padding="20dp"
android:orientation="horizontal">
<TextView
android:text="1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginEnd="10dp"
/>
<TextView
android:text="2"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginStart="10dp"
/>
Try with this layout xml.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:id="#+id/heading1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#4CAF50"
android:padding="5dp"
android:text="1"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#ffffff" />
<TextView
android:id="#+id/heading2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#4CAF50"
android:padding="5dp"
android:text="2"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>
Try this one :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:layout_weight="100"
android:orientation="horizontal">
<TextView
android:id ="#+id/Heading_1"
android:text="1"
android:layout_width="0dp"
android:layout_weight="50"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
<TextView
android:id ="#+id/Heading_2"
android:text="2"
android:layout_width="0dp"
android:layout_weight="50"
android:layout_height="wrap_content"
android:textAppearance="?android:textAppearanceMedium"
android:background="#4CAF50"
android:padding="10dp"
android:textColor="#ffffff"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
</LinearLayout>
Results :
Give android:layout_marginEnd="10dp"on the First TextView
Give android:layout_marginStart="10dp"on the Second TextView
Was Able to achieve this using below code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#A1887F"
android:orientation="horizontal">
<TextView
android:id="#+id/btn1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:padding="10dp"
android:background="#4CAF50"
android:text="1"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#ffffff" />
<TextView
android:id="#+id/btn2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:padding="10dp"
android:background="#4CAF50"
android:text="2"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#ffffff" />
</LinearLayout>

The order in layout changes after i put the custom layout resource file in listview

I made a good code in which the text 1 schedule here and 2 schedule here were aligned similar vertically. But i put this layout in list view and so the 7 names of days are not same, layout is changed.my custom layout had this code.
<?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="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:background="#drawable/listback">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="25dp"
android:paddingRight="80dp"
android:gravity="center_vertical"
android:text="Day name"
android:textColor="#ffffff"
android:textStyle="bold"
android:id="#+id/dayname" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingLeft="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1 schedule here"
android:textSize="20dp"
android:textColor="#ffffff"
android:textStyle="bold"
android:id="#+id/mytext1"
android:layout_marginTop="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1 schedule here"
android:textSize="20dp"
android:textColor="#ffffff"
android:textStyle="bold"
android:id="#+id/mytext2"
android:layout_marginTop="5dp"/>
<TextView
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:textStyle="bold"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Total"
android:id="#+id/totaltext" />
</LinearLayout>
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:id="#+id/lightStatus"
android:layout_marginLeft="35dp"
android:src="#drawable/gray"/>
</LinearLayout>
</LinearLayout>
So how can i manage layout so that my 1 schedule and 2 schedule texts will be in same line vertically after i put them in list view
Image putting list view is shown
Hi you can try to this xml code hope this can help you...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:background="#android:color/darker_gray"
android:orientation="horizontal">
<TextView
android:id="#+id/dayname"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:gravity="center_vertical"
android:text="Wednesday"
android:textColor="#ffffff"
android:textSize="25sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="5dp"
android:weightSum="3">
<TextView
android:id="#+id/mytext1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="center"
android:text="Nov 18 2016 Friday"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/mytext2"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:gravity="center"
android:text="no day available"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/totaltext"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="no day available"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffff"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="#+id/lightStatus"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginLeft="35dp"
android:src="#mipmap/ic_launcher" />
</LinearLayout>
</LinearLayout>

Views showing capital letters in android layout

Hi I am working in a app.
In the layout I have used text as "Tamil" in that format(Firs letter capital others in small).
The part of the layout :
<LinearLayout
android:id="#+id/music_menu_logged_out_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible" >
<LinearLayout
android:id="#+id/music_menu_header_bar1"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="3" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginRight="5dp"
android:layout_weight=".70"
android:gravity="center" >
<com.mikhaellopez.circularimageview.CircularImageView
android:id="#+id/music_menu_profile_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:src="#drawable/username" />
</LinearLayout>
<Button
android:id="#+id/music_menu_login"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="15dp"
android:layout_weight="1.15"
android:background="#drawable/menu_login_sidebar_bar1"
android:gravity="center"
android:text="Login"
android:textColor="#ffffff" />
<Button
android:id="#+id/music_menu_signup"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="15dp"
android:layout_weight="1.15"
android:background="#drawable/menu_login_sidebar_bar1"
android:gravity="center"
android:text="Sign up"
android:onClick="musicMenuSignUp"
android:textColor="#ffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="35dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="5dp"
android:layout_weight=".70"
android:gravity="center" />
<TextView
android:id="#+id/music_menu_or"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1.15"
android:gravity="center|right"
android:text="- or "
android:textColor="#ffffff"
android:textSize="15sp" />
<TextView
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="1.15"
android:gravity="center|left"
android:text="-"
android:textColor="#ffffff"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="3" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="5dp"
android:layout_weight=".70"
android:gravity="center" >
</LinearLayout>
<Button
android:id="#+id/music_menu_facebook"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="15dp"
android:layout_weight="1.15"
android:background="#drawable/menu_login_sidebar_facebook"
android:gravity="center"
android:text="Facebook"
android:onClick="musicMenuFacebook"
android:textColor="#ffffff" />
<Button
android:id="#+id/music_menu_google"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="15dp"
android:layout_weight="1.15"
android:background="#drawable/menu_login_sidebar_google_plus"
android:gravity="center"
android:text="Google"
android:onClick="musicMenuGoogle"
android:textColor="#ffffff" />
</LinearLayout>
</LinearLayout>
We can see that the text="" attribute in the "Format". But the layout looks like below.
Couldn't guess what mistake I did or anything happened wrong.I didn't use any stuff dynamically(programmattically).
What are all the possibles to this ?
Try adding this to textview : android:textAllCaps="false"

Android - How to make textfields center alligned for different android devices

I am working on android application.I am newbie in android app development.
I get to test the app for few android devices. But the layout looks different for different devices. i have created screen shots for reference.
CODE:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/bgcopy"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayout1"
style="#style/TitleBar" >
<Button
android:id="#+id/back"
android:layout_width="60dp"
android:layout_height="30dip"
android:layout_marginLeft="7dip"
android:background="#drawable/bround1"
android:text="#string/back"
android:textColor="#color/White"
android:textStyle="bold" />
<TextView
style="#style/TitleBarText"
android:gravity="center"
android:text="#string/testApp"
android:textSize="16dp" />
<Button
android:id="#+id/home"
android:layout_width="60dip"
android:layout_height="30dip"
android:layout_marginRight="7dip"
android:background="#drawable/bround1"
android:text="#string/home"
android:textColor="#color/White"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="1.5dp"
android:background="#color/Black" >
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignBottom="#+id/relativeLayout1"
android:orientation="horizontal"
android:background="#drawable/blackroundshape"
android:gravity="center">
<TextView
android:id="#+id/restrictions"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:background="#drawable/blackroundshape"
android:gravity="center"
android:layout_gravity="center"
android:selectAllOnFocus="true"
android:text="Details"
android:textColor="#color/White"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/locations"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:background="#drawable/blackroundshape"
android:gravity="center"
android:layout_gravity="center"
android:text="#string/locations"
android:textColor="#color/White"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/news"
android:layout_width="128dip"
android:layout_height="54dip"
android:layout_marginLeft="0.5dip"
android:layout_weight="1"
android:background="#drawable/blackroundshape"
android:gravity="center"
android:layout_gravity="center"
android:selectAllOnFocus="true"
android:text="#string/news"
android:textColor="#color/White"
android:textSize="15dip"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/linearLayout1"
android:orientation="horizontal"
android:background="#drawable/backbutton"
android:gravity="center"
>
<TextView
android:id="#+id/reserve"
android:layout_width="115dip"
android:layout_height="58dip"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:background="#drawable/backbutton"
android:gravity="center"
android:layout_gravity="center"
android:text="#string/reserve"
android:textColor="#color/White"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/favorite"
android:layout_width="115dip"
android:layout_height="58dip"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:background="#drawable/backbutton"
android:gravity="center"
android:layout_gravity="center"
android:text="#string/favorite"
android:textColor="#color/White"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/share"
android:layout_width="128dip"
android:layout_height="58dip"
android:layout_weight="1"
android:background="#drawable/backbutton"
android:gravity="center"
android:layout_gravity="center"
android:selectAllOnFocus="true"
android:text="#string/share"
android:textColor="#color/White"
android:textSize="15dip"
android:textStyle="bold" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="504dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="fill_parent"
android:layout_height="170dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="7dp"
android:background="#drawable/round_transperent2" >
<ImageView
android:id="#+id/image"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="11dp"
android:src="#drawable/default_ptr_rotate" />
<TextView
android:id="#+id/couponText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/image"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:layout_toRightOf="#+id/image"
android:text="TextView"
android:textColor="#color/Black"
android:typeface="serif" />
<TextView
android:id="#+id/save_textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/image"
android:layout_below="#+id/image"
android:layout_marginLeft="1dp"
android:paddingLeft="1dp"
android:text="#string/save"
android:textColor="#color/mightyBlue"
android:textSize="19sp"
android:textStyle="bold" />
<TextView
android:id="#+id/upto_textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/save_textView2"
android:layout_alignBottom="#+id/save_textView2"
android:layout_alignRight="#+id/image"
android:layout_marginLeft="3dp"
android:layout_toRightOf="#+id/save_textView2"
android:text="#string/upto"
android:textColor="#color/Gray" />
<TextView
android:id="#+id/amountDetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/save_textView2"
android:layout_below="#+id/save_textView2"
android:layout_marginBottom="4dp"
android:paddingLeft="1dp"
android:text="#string/amount"
android:textColor="#color/mightyBlue"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/amountDetails"
android:layout_alignLeft="#+id/couponText"
android:text="Expires on:"
android:textColor="#color/Black"
android:typeface="serif"
android:visibility="invisible" />
<TextView
android:id="#+id/expitydate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/amountDetails"
android:layout_toRightOf="#+id/textView5"
android:maxLength="10"
android:textColor="#color/Black"
/>
</RelativeLayout>
<TextView
android:id="#+id/RemainingDays_textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView7"
android:layout_below="#+id/relativeLayout2"
android:text="Remaning Days"
android:textColor="#color/mightyBlue" />
<TextView
android:id="#+id/textView6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/RemainingDays_textView1"
android:layout_centerHorizontal="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="center"
android:text="#string/redeem"
android:textColor="#color/Black"
android:textSize="16dp"/>
<TextView
android:id="#+id/textView7"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView6"
android:layout_below="#+id/textView6"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="3dp"
android:gravity="center"
android:text="#string/redeemnow"
android:textColor="#color/Red"
android:textSize="18dp" />
<TextView
android:id="#+id/YES"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_alignLeft="#+id/textView7"
android:layout_below="#+id/textView7"
android:layout_marginLeft="35dp"
android:layout_marginTop="20dp"
android:background="#drawable/yellow_ball"
android:gravity="center"
android:text="YES"
android:textColor="#color/Black"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="#+id/No"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_alignBaseline="#+id/YES"
android:layout_alignBottom="#+id/YES"
android:layout_alignRight="#+id/textView7"
android:layout_marginRight="44dp"
android:background="#drawable/yellow_ball"
android:gravity="center"
android:text="NO"
android:textColor="#color/Black"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
2nd screen shot shows the issue. I have completed the functional aspect of the app but unable to submit app due to this issue. Any help will be appriciated.
Thank You!!!
The containing LinearLayout should have gravity = center to center the TextView children and android:layout_alignParentBottom="true" (I see you have a RelativeLayout as a parent container):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/navBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="#+id/restrictions"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:selectAllOnFocus="true"
android:text="Details"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/locations"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:text="Locations"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/news"
android:layout_width="128dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginLeft="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:selectAllOnFocus="true"
android:text="news"
android:textSize="15dip"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/navBar"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="#+id/restrictions"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:selectAllOnFocus="true"
android:text="Details"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/locations"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:text="Locations"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/news"
android:layout_width="128dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginLeft="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:selectAllOnFocus="true"
android:text="news"
android:textSize="15dip"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="#+id/restrictions"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:selectAllOnFocus="true"
android:text="Details"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/locations"
android:layout_width="115dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginRight="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:text="Locations"
android:textSize="15dip"
android:textStyle="bold" />
<TextView
android:id="#+id/news"
android:layout_width="128dip"
android:layout_height="54dip"
android:layout_gravity="center"
android:layout_marginLeft="0.5dip"
android:layout_weight="1"
android:gravity="center"
android:selectAllOnFocus="true"
android:text="news"
android:textSize="15dip"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Have added different layouts for different screen sizes?
Refer : http://developer.android.com/guide/practices/screens_support.html
For Different screen size, The following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for small, medium, high, and extra high density screens.
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
res/drawable-mdpi/my_icon.png // bitmap for medium density
res/drawable-hdpi/my_icon.png // bitmap for high density
res/drawable-xhdpi/my_icon.png // bitmap for extra high density
The following code in the Manifest supports all dpis.
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
Try this,
using layout_weight attribute you can bring this exactly.
Double check to make sure you have the correct hierarchy with the proper layouts wrapping other layouts. For the 2nd bar from the top with "Reserve, Favorite, Share" use a Linear Layout with weights of 1 on the text views and be sure that the TV's width = 0dp. Then create the bottom bar with "Details, Location, News" and align that to the bottom. Then have the middle white part as a layout with attributes layout_below="topbar" and layout_above="bottombar"
Here's some sudo code to give you an idea
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- Top Bar -->
<LinearLayout
andorid:name="#+id/nav_bar"
android:layout_alignParentTop="true"
android:layout_width=... />
<!-- Second to Top Bar -->
<LinearLayout
android:name="#+id/reserve_bar"
android:layout_width="fill_parent"
android:layout_height="54dp"
android:layout_below="#id/nav_bar"
android:orientation="vertical" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
... />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
... />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
... />
</LinearLayout>
<!-- Very Bottom Bar -->
<LinearLayout
android:name="#+id/details_bar"
android:layout_width="fill_parent"
android:layout_height="54dp"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
... />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
... />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
... />
</LinearLayout>
<!-- Body of the layout below 2nd bar and above bottom bar-->
<RelativeLayout
android:name="#+id/body_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#id/reserve_bar"
android:layout_above="#id/detail_bar" >
<RelativeLayout>
android:stuff="..."
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
I think the problem is that you are have align_bottom attributes on some things that shouldn't be there. Those are override the alignParentBottom

Categories

Resources