How to layout three buttons evenly located under LinearLayout? - android

I have three buttons need to be located in one line at the bottom of the screen. Below is the code in activity xml. In order to make the three button takes even space, I wrap each of them inside a LinearLayout and set the layout android:layout_weight to 1 and android:layout_gravity to center.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90px"
android:background="#88104502"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:id="#+id/goBack"
android:layout_width="70px"
android:layout_height="80px"
android:gravity="center"
android:background="#drawable/back"
android:onClick="toHomePage" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:id="#+id/findPlant"
android:layout_width="70px"
android:layout_height="80px"
android:gravity="center"
android:background="#drawable/flowr"
android:onClick="toImagePage" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:layout_weight="1">
<Button
android:id="#+id/plantList"
android:layout_width="70px"
android:layout_height="80px"
android:gravity="center"
android:background="#drawable/list" />
</LinearLayout>
</LinearLayout>
But it the button is not located in the center of the LinearLayout. Below is the screenshot:
You can see that each button is located on the left of the LinearLayout. How to make them center located?

If you want a button with an image you can use ImageButton instead of Button, and you can try like this, and instead using nested layout you can give directly weight to ImageButton.
If you want to style a button you can use AppCompatImageButton in that you can use app:backgroundTint to change the background.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90px"
android:background="#88104502"
android:weightSum="3"
android:orientation="horizontal">
<ImageButton
android:id="#+id/goBack"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:onClick="toHomePage"
android:src="#drawable/ic_action_name"/>
<ImageButton
android:id="#+id/findPlant"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:onClick="toImagePage"
android:src="#drawable/ic_action_name"/>
<ImageButton
android:id="#+id/plantList"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:onClick="toImagePage"
android:src="#drawable/ic_action_name"/>
</LinearLayout>

Try this. I use your code only give gravity to linear layout.If you do not want to use this much of LinearLayout use only one main LinearLayout and give equal weight to 3 buttons.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="90px"
android:background="#88104502"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="horizontal"
android:gravity="center"
android:layout_weight="1">
<Button
android:id="#+id/goBack"
android:layout_width="70px"
android:layout_height="80px"
android:gravity="center"
android:background="#mipmap/ic_launcher"
android:onClick="toHomePage" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:id="#+id/findPlant"
android:layout_width="70px"
android:layout_height="80px"
android:gravity="center"
android:background="#mipmap/ic_launcher"
android:onClick="toImagePage" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1">
<Button
android:id="#+id/plantList"
android:layout_width="70px"
android:layout_height="80px"
android:background="#mipmap/ic_launcher" />
</LinearLayout>

you can create an empty view as the padding. this way the spacing will always be the same even if the icon widths are different.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90px"
android:background="#88104502"
android:orientation="horizontal">
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="0dp"/>
<Button
android:id="#+id/button1"
android:layout_width="70px"
android:layout_height="80px"
android:background="#drawable/list" />
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="0dp"/>
<Button
android:id="#+id/button2"
android:layout_width="70px"
android:layout_height="80px"
android:background="#drawable/list" />
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="0dp"/>
<Button
android:id="#+id/button3"
android:layout_width="70px"
android:layout_height="80px"
android:background="#drawable/list" />
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="0dp"/>
</LinearLayout>

Use gravity instead of layout_gravity.

Related

How to layout 4 views side by side with 1 view centered

I am trying to layout 4 views (2 buttons, 2 TextViews) at the top of my activity. I need button_2 to be centered horizontally, TextView_2 to take up the rest of the space to the right-hand side of the view, button_1 to wrap_content and be pinned to the left of the parent and textView_1 to fill the space between button_1 and button_2.
My code so far:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:id="#+id/textView_1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="#+id/button_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_weight="1"/>
<TextView
android:id="#+id/textView_2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="button_1"/>
<TextView
android:id="#+id/textView_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="#+id/button_1"
android:layout_toLeftOf="#+id/button_2"
android:layout_alignBottom="#+id/button_2"
android:text="textView_1"/>
<Button
android:id="#+id/button_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="button_2"/>
<TextView
android:id="#+id/textView_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="textView_2"
android:gravity="center"
android:layout_alignBottom="#+id/button_2"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/button_2" />
</RelativeLayout>
Relative Layout will suit to your condition perfectly. Use android:layout_toRightOf, android:layout_toLeftOf, android:layout_alignParentRight and android:layout_alignParentLeft properties wisely.
<RelativeLayout
android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/button_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"/>
<TextView
android:id="#+id/textView_1"
android:layout_toRightOf="#+id/button_1"
android:layout_toleftOf="#+id/button_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello there"/>
<Button
android:id="#+id/button_2"
android:layout_width="wrap_content"
android:layout_toRightOf="#+id/textView_1"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="#+id/textView_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/button_2"
android:layout_alignParentRight="true"/>
</RelativeLayout>
Try this
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1">
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
remove layout weight in child linear layout and height is change to wrap content for textview and button to fulfull your requirements

Align Button to Bottom using LinearLayout

Trying to align button at Bottom using LinearLayout, but getting just below TextView.
To set button at bottom, I am using android:layout_gravity="bottom" but still not done
LinearLayout xml
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_gravity="bottom"
android:layout_height="wrap_content">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Bottom" />
</LinearLayout>
</LinearLayout>
Change second linear layout to
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
This will put the button at the bottom and this layout will take the rest of the space
Yoy have to use like this....
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Bottom" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_gravity="bottom"
android:layout_height="wrap_content">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Bottom" />
</LinearLayout>
</LinearLayout>
I could not use the suggested answer as I had multiples of 3 vertical ones (each with specific weights) inside a horizontal one. So, ended up using margin top for specific button/widget instead. Working fine so far.
Did not want to change to RelativeLayout as that meant many changes in this scenario.

How to give layout weight in RelativeLayout?

I have created a dialpad using LinearLayout. Here is the code
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:clickable="true"
android:text="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/tv_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:clickable="true"
android:text="2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/tv_three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="3" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="4" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="6" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="7" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="8" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="9" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:clickable="true"
android:text="*" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:clickable="true"
android:text="0" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="64dp"
android:text="#" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Which looks like this
Now i want the same in RelativeLayout, but i find layout_weight doesn't work in RelativeLayout. I also don't want to use LinearLayout inside RelativeLayout.
Or is there any alternative which can work same like layout_weight works in LinearLayout but for RelativeLayout
You cannot use percentages to define the dimensions of a View inside a RelativeLayout. The best ways to do it is to use LinearLayout and weights, or a custom Layout.
Fore more information you can look at this question
If you want to stay with relative layout you can try to change the locations through the code. get the height and width of the outer layout using:
RelativeLayout rl = (RelativeLayout) findViewById(R.id.relative);
rl.getWidth();
rl.getHeight();
and then get the params of the layout you want to evenly distribute:
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(50, 50); //here i created a new one with size 50,50
now you can set params.leftMargin and params.topMargin the way you want with any calculation.
params.leftMargin = rl.getWidth()/4 ;
for example will set the new layout at the 1/4 of the screen width
RelativeLayout is not a good choice because it doesn't provide a way you to evenly distribute children the way LinearLayout does. If you want something other than nested LinearLayouts, you can try using GridLayout (not GridView).
You cannot use layout_weight in RelativeLayout. Looking over your XML, your current layout is poorly structured which will lead to poor performance. I suggest that you use either GridLayout or Use your current LinearLayout but instead of assigning a LinearLayout to each number/character you can do something like this instead (Only for first row, but you get the idea):
`
<LinearLayout
android:id="#+id/LL_topRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3"
android:layout_margin="2dp">
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="64sp"
android:clickable="true"
android:gravity="center"
android:text="1" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="64sp"
android:clickable="true"
android:gravity="center"
android:text="2" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="64sp"
android:clickable="true"
android:gravity="center"
android:text="3" />
</LinearLayout>
<!-- Next LinearLayout Here for next row -->
`

Android Button layout with big text size

I'm trying to make two identical buttons with the same height, but when the text is too long (the second button) then breaks markup. How can I fix it?
xml layout:
<?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">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<Button
android:text="test"
android:layout_height="100dp"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:padding="0dp"
android:text="Arterial tension disturbance"
android:layout_height="100dp"
android:layout_width="0dp"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
Add android:singleLine="true"
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<Button
android:singleLine="true"
android:text="test"
android:layout_height="100dp"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:singleLine="true"
android:padding="0dp"
android:text="Arterial tension disturbance"
android:layout_height="100dp"
android:layout_width="0dp"
android:layout_weight="1"/>
</LinearLayout>
use wrap_content instead of 0dp
<Button
android:padding="0dp"
android:text="Arterial tension disturbance"
android:layout_height="100dp"
android:layout_width="wrap_content"
android:layout_weight="1"/>
You can try this: (Edited)
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100" >
<Button
android:layout_width="fill_parent"
android:text="yourText"
android:layout_height="wrap_content"
android:layout_weight="50" />
<Button
android:layout_width="fill_parent"
android:text="yourText"
android:layout_height="wrap_content"
android:layout_weight="50" />

android linearlayout baseline align

I have 3 imageviews but since they overlap i wont make them clickable, i want make buttons on top of each imageview(but smaller).
I know in RelativeLayout there is easy way out using align_baseline but it is very important that i use LinearLayout for these images because they use layout_weight
And its important that button is connected with imageview, not just appearing on top of it
And here is my code it might help
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/twitter"
android:layout_alignParentLeft="true"
android:orientation="vertical"
android:weightSum="3"
android:layout_marginBottom="25dp"
android:layout_alignParentTop="true" >
<ImageView
android:id="#+id/imgDis"
android:layout_weight="1"
android:layout_width="300dp"
android:layout_height="120dp"
android:layout_marginBottom="-20dp"
android:background="#drawable/img1" />
<ImageView
android:id="#+id/imgCal"
android:layout_weight="1"
android:layout_width="300dp"
android:layout_height="120dp"
android:layout_gravity="right"
android:layout_marginBottom="-25dp"
android:background="#drawable/img2"
android:paddingLeft="25dp" />
<ImageView
android:id="#+id/imgDe"
android:layout_weight="1"
android:layout_width="300dp"
android:layout_height="120dp"
android:background="#drawable/img3" />
</LinearLayout>
...
</RelativeLayout>
put the image in another linear layout vertical and place that layout inside your mainlayout and give the wieght to this linearlayout instead of the image
Here is your answer, while using weight you must define 0dp to height/width to view as per case.
You want Button on every Imageview something like below?
I tried, check below xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="25dp"
android:orientation="vertical"
android:weightSum="6" >
<Button
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="0.5"
android:text="button first" />
<ImageView
android:id="#+id/imgDis"
android:layout_width="300dp"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="1.5"
android:background="#drawable/logo" />
<Button
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="0.5"
android:text="button first" />
<ImageView
android:id="#+id/imgCal"
android:layout_width="300dp"
android:layout_height="0dp"
android:layout_gravity="right"
android:layout_marginTop="5dp"
android:layout_weight="1.5"
android:background="#drawable/logo"
android:paddingLeft="25dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="0.5"
android:text="button first" />
<ImageView
android:id="#+id/imgDe"
android:layout_width="300dp"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="1.5"
android:background="#drawable/logo" />
</LinearLayout>
</RelativeLayout>

Categories

Resources