I am using android:weight attribute.
First state
http://s1.postimg.org/umygk8han/first.png
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="223"
android:orientation="horizontal" >
</LinearLayout>
When add TextView
http://s7.postimg.org/89qjb42dn/two.png
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="223"
android:orientation="horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Sample"
android:textColor="#android:color/background_dark" />
</LinearLayout>
How can I solve this problem?
Best regards
I think that initially you need a RelativeLayout outside of the
LinearLayout , because I don't think it is a good idea to
assign layout_weight to a LinearLayout.
So do it like this:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="223"
android:orientation="horizontal" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Sample"
android:maxLines="1"
android:textColor="#android:color/background_dark" />
</RelativeLayout>
PS: I set the android:layout_height="0dp" of this RelativeLayout because it looked to me (according to the screenshots) that it was a node of a LinearLayour with orientation='vertical'
I understand that the linearlayout expands due to font size in the textView, try to decrease font size.
<TextView ....
android:textSize="9sp" />
Also you could try to set padding textview to 0
android:padding="0dp"
Hope it helps!
try setting android:layout_height="match_parent" in your TextView to android:layout_height="wrap_content"
Please try to use bellow code.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dip"
android:weightSum="2" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Sample" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dip"
android:weightSum="2" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Sample"
android:textColor="#android:color/background_dark" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dip"
android:weightSum="2" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Sample"
android:textColor="#android:color/background_dark" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dip"
android:weightSum="2" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Sample"
android:textColor="#android:color/background_dark" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="vertical"
android:padding="5dip"
android:weightSum="2" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Sample" />
</LinearLayout>
Related
I am trying to build a little Android App and I need two LinearLayout side by side. (50/50)
How it looks:
http://i.stack.imgur.com/C9yCF.png
I already try to use: android:layout_width="0dp" android:layout_weight="1" but it didn't work.
This is my XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/part">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="9pt"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:baselineAligned="true"
android:background="#ff7f7f7f"
android:id="#+id/head">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="123456789"
android:id="#+id/textView"
android:paddingStart="3pt"
android:paddingLeft="3pt"
android:textColor="#ffffffff"
android:singleLine="false" />
</LinearLayout>
<LinearLayout
android:id="#+id/left"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_below="#+id/head"
android:background="#ffff0100" >
</LinearLayout>
<LinearLayout
android:id="#+id/right"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/head"
android:background="#fffcff00" />
How it should look:
http://i.stack.imgur.com/tup01.png
Have one more LinearLayout with horizontal orientation below your #+id/head LinearLayout.
Set its width to match_parent. Keep the last two LinearLayouts inside the new LinearLayout and have android:layout_weight=0.5 for both. Something like:
<RelativeLayout>
<LinearLayout> </LinearLayout>
<LinearLayout
...
android:orientation:"horizontal"/>
<LinearLayout
android:weight="0.5"
android:width="0dp"
... />
</LinearLayout>
<LinearLayout
android:weight="0.5"
android:width="0dp"
... />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
You can't use layout_weight with RelativeLayouts children. Put/Wrap both LinearLayouts in another LinearLayout.
Hey try this code...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/part"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/head"
android:layout_width="fill_parent"
android:layout_height="9pt"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#ff7f7f7f"
android:baselineAligned="true"
android:orientation="vertical" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="3pt"
android:paddingStart="3pt"
android:singleLine="false"
android:text="123456789"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffffffff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/head"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/left"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#ffff0100"
android:orientation="vertical" >
</LinearLayout>
<LinearLayout
android:id="#+id/right"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#fffcff00"
android:orientation="vertical" />
</LinearLayout>
I checked out a similar question to this but it didn't solve my problem.
From top to bottom, I'm try to display:
a TextView (header)
a ListView with an index strip to the right of it (I use horizontal LinearLayout for this pair)
a TextView (footer)
Everything appears except my footer TextView.
Can somebody please tell me what is wrong with my XML?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/tvHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:background="#00F"
android:textColor="#android:color/white"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content" >
<ListView
android:id="#android:id/list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fastScrollEnabled="true" />
<LinearLayout
android:id="#+id/sideIndex"
android:layout_width="40dip"
android:layout_height="wrap_content"
android:background="#FFF"
android:gravity="center_horizontal"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/tvFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:background="#0F0"
android:textColor="#F00"
android:textStyle="bold" />
</LinearLayout>
Try this..
change android:layout_height="wrap_content" to android:layout_height="0dp" and add android:layout_weight = "1" for the middle LinearLayout
Change this..
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content" >
to
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_weight = "1"
android:layout_height="0dp" >
LinearLayout
1) http://developer.android.com/reference/android/widget/LinearLayout.html
2) http://developer.android.com/guide/topics/ui/layout/linear.html
RelativeLayout
1) http://developer.android.com/reference/android/widget/RelativeLayout.html
2) http://developer.android.com/guide/topics/ui/layout/relative.html
Better you try RelativeLayout. Check this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/tvHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00F"
android:text="TextView"
android:textColor="#android:color/white"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/tvFooter"
android:layout_below="#+id/tvHeader"
android:orientation="horizontal" >
<ListView
android:id="#android:id/list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fastScrollEnabled="true" />
<LinearLayout
android:id="#+id/sideIndex"
android:layout_width="40dip"
android:layout_height="wrap_content"
android:background="#FFF"
android:gravity="center_horizontal"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/tvFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#0F0"
android:text="TextView"
android:textColor="#F00"
android:textStyle="bold" />
</RelativeLayout>
add this attribute to your 2nd Linear layout.
android:layout_weight = "1"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation="vertical"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/tvHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:background="#00F"
android:textColor="#android:color/white"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_weight = "1" <!-- here -->
>
.......
You could use a RelativeLayout
<?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" >
<TextView
android:id="#+id/tvHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:background="#00F"
android:textColor="#android:color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/tvFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#0F0"
android:text="TextView"
android:textColor="#F00"
android:textStyle="bold" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_below="#+id/tvHeader"
android:layout_above="#+id/tvFooter"
android:orientation="horizontal"
android:layout_height="wrap_content" >
<ListView
android:id="#android:id/list"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fastScrollEnabled="true" />
<LinearLayout
android:id="#+id/sideIndex"
android:layout_width="40dip"
android:layout_height="wrap_content"
android:background="#FFF"
android:gravity="center_horizontal"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Use RelativeLayout, it will be easier to show or reposition other items.
How can change my layout to make image 1 more like image 2? I don't mind if it's the text that moves up or the image that moves up.
my layout file is like so :-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/imp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/stats_chr" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:singleLine="true"
android:text="AA" />
</LinearLayout>
Accepted answer does not works for me. Here is my solution
Add android:scaleType="fitStart" to the ImageView.
Try this..
Use android:gravity="top" for LinearLayout or android:layout_gravity="top" for ImageView
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:gravity="top"
android:layout_weight="0.6"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:src="#drawable/imp" />
</LinearLayout>
I'm new android. I have a little bit stack in designing layout for Android. In my scenario, I have two button with Linear Layout. Here my xml.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="#color/isp_home_color"
>
<Button
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_weight="1"
android:text="#string/sync_text"
android:background="#color/sync_text_color"
android:id="#+id/btn_syncpin"
android:layout_gravity="left"
android:textStyle="bold"
/>
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="70dp"
android:text="#string/topup_text"
android:background="#color/topup_text_color"
android:id="#+id/btn_topup"
android:layout_gravity="right"
android:textStyle="bold"/>
<!--Table Layout will come here -->
</LinearLayout>
Here image for this.
When I add new TableLayout inside Linear Layout. I got this.
Here my xml for Table Layout.
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</TableLayout>
Actually, I don't want like this. I want two button as shown in first image. Then, next table layout will occur under this two button. Please help me how can I do this layout. Please pointing to me how to make this. Thanks with advanced.
Give orientation as vertical to the LinearLayout not the TableLayout.Put Two buttons in a LinearLayout with orizontal orientation and give orientation "vertical" for the parent LinearLayout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#456789"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:orientation="horizontal">
<Button
android:id="#+id/btn_syncpin"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_gravity="left"
android:layout_weight="1"
android:background="#123456"
android:text="tring/"
android:textStyle="bold" />
<Button
android:id="#+id/btn_topup"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_gravity="right"
android:layout_weight="1"
android:background="#978969"
android:text="topup_text"
android:textStyle="bold" />
</LinearLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF" >
</TableLayout>
</LinearLayout>
Check this out, I just checked it on my Machine and it works as desired, although the background preference and the display strings have been removed.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_syncpin"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_gravity="left"
android:layout_weight="1"
android:textStyle="bold" />
<Button
android:id="#+id/btn_topup"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_gravity="right"
android:layout_weight="1"
android:textStyle="bold" />
</LinearLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="#+id/linearLayout2">
</TableLayout>
</RelativeLayout>
take Relative Layout as a parent layout.
Following is an example. it will display your buttons and table layout too
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/isp_home_color"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_syncpin"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_gravity="left"
android:layout_weight="1"
android:background="#color/sync_text_color"
android:text="#string/sync_text"
android:textStyle="bold" />
<Button
android:id="#+id/btn_topup"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_gravity="right"
android:layout_weight="1"
android:background="#color/topup_text_color"
android:text="#string/topup_text"
android:textStyle="bold" />
</LinearLayout>
<TableLayout
android:id="#+id/table"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/linearLayout2" >
</TableLayout>
</RelativeLayout>
thanks
This answer tells only implementation of button_bar_layout for all android versions with buttons at the bottom/top of an activity which look like AlertDialog with OK/Cancel buttons.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?android:attr/listDivider"
android:orientation="vertical"
android:showDividers="middle" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:divider="?android:attr/listDivider"
android:dividerPadding="12dp"
android:orientation="horizontal"
android:showDividers="middle" >
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:drawable/list_selector_background"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="One" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:drawable/list_selector_background"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="Two" />
</LinearLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF" >
</TableLayout>
</LinearLayout>
Credits: Who else ? Johnkil
// try this way here i gave you alternative to achieve your requirement from give all of above
1. header.xml
<?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="wrap_content"
android:orientation="horizontal"
android:background="#color/isp_home_color">
<Button
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_weight="1"
android:text="#string/sync_text"
android:background="#color/sync_text_color"
android:id="#+id/btn_syncpin"
android:textStyle="bold"/>
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="70dp"
android:text="#string/topup_text"
android:background="#color/topup_text_color"
android:id="#+id/btn_topup"
android:textStyle="bold"/>
</LinearLayout>
2.main.xml
<?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:padding="5dp"
android:orientation="vertical">
<include
layout="#layout/header"/>
<TableLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_weight="1">
</TableLayout>
</LinearLayout>
The android layout lacks proportion when I set the background of Imagebutton.
And the code of xml is like the following:
<?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:baselineAligned="false"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/player_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/buttonLayout" >
<FrameLayout
android:id="#+id/player_surface_frame"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" >
<SurfaceView
android:id="#+id/player_surface"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center" />
</FrameLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/findCameraButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:text="#string/label_find_camera" />
<Button
android:id="#+id/SettingButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:text="#string/Camera_WiFi_setup" />
<ImageButton
android:id="#+id/FileSavebutton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="#drawable/save_in_camera" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/TimeStampLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dip"
android:text=""
android:textColor="#ffff00"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/snapshotButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="#string/label_app_snapshot" />
<Button
android:id="#+id/recordButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="#string/label_app_record" />
<ImageButton
android:id="#+id/photo_record_mode"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="#drawable/turn_to_photomode"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
How to setup can make the top of LinearLayout no deformation like the LinearLayout of bottom ?
Have you tried changing all the android:layout_height values from match_parent to wrap_content?
i think you should use scaleType to get your image look nice
prefer fitXY
like that
android:scaleType="fitXY"
put inside your xml to be whole code like that
<ImageButton
android:id="#+id/photo_record_mode"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="#drawable/turn_to_photomode"
android:scaleType="fitXY"/>