**i have button in that i want to put space between all button so if i run app in tablet the space between button will equal divide, i am using linearlayout, i know there is layout_weight option but i don't want to stretch icon **
<LinearLayout
android:orientation="horizontal"
android:gravity="bottom|right"
android:background="#00ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:id="#+id/linearLayout">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/call"
android:background="#drawable/layoutcornerbend"
android:layout_gravity="bottom"
android:src="#drawable/e"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/layoutcornerbend"
android:id="#+id/navigation"
android:layout_gravity="bottom"
android:src="#drawable/navi"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/layoutcornerbend"
android:id="#+id/stream"
android:layout_gravity="bottom"
android:src="#drawable/appstream"/>
</LinearLayout>
Here is the great article by #Cyril Mottier to add spacing when you use LinearLayout. Kindly follow this.
http://cyrilmottier.com/2014/11/17/grid-spacing-on-android/
Basically you just have to use the parameter:
android:divider
use margin
<LinearLayout
android:orientation="horizontal"
android:gravity="bottom|right"
android:background="#00ffffff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:id="#+id/linearLayout">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/call"
android:background="#drawable/layoutcornerbend"
android:layout_gravity="bottom"
android:src="#drawable/e"
**android:layout_marginRight="10dp"**
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/layoutcornerbend"
android:id="#+id/navigation"
android:layout_gravity="bottom"
**android:layout_marginRight="10dp"**
android:src="#drawable/navi"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/layoutcornerbend"
android:id="#+id/stream"
android:layout_gravity="bottom"
android:src="#drawable/appstream"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="log in"
android:textAllCaps="true"
android:layout_weight="1"
android:background="#E0B13B"/>
<view
android:layout_width="10dp"
android:layout_height="0dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="register"
android:textAllCaps="true"
android:layout_weight="1"
android:background="#67A22C"/>
</LinearLayout>>
Related
This is my LayoutActivity, and above the LinearLayout where are the "No, Name, Price and Change 24H." appear a big gap on my phone (Samsung S7), look here. On my Android Studio virtual machine, there isn't one, look here. What is causing this gap and how to fix it?
I include the LayoutActivity code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#android:color/white"
android:elevation="10dp"
android:weightSum="3">
<Button
android:id="#+id/home_button"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_weight="1"
android:background="#5078909c "
android:text="Overview"
android:textStyle="bold" />
<Button
android:id="#+id/portfolio_button"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Portfolio" />
<Button
android:id="#+id/settings_button"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_weight="1"
android:background="#android:color/white"
android:text="Settings" />
</LinearLayout>
<Button
android:id="#+id/refresh_button"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:text="Refresh" />
<ListView
android:id="#+id/CoinList"
android:layout_width="match_parent"
android:layout_height="385dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="48dp" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_above="#+id/CoinList"
android:background="#android:color/white"
android:layout_alignParentEnd="true"
android:elevation="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/Background_for_buttons"
android:layout_weight="1"
android:background="#803f51b5"
android:gravity="center"
android:text="No"
android:textColor="#FF000000"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="128dp"
android:layout_height="30dp"
android:layout_alignParentStart="true"
android:layout_below="#+id/Background_for_buttons"
android:layout_weight="1"
android:background="#803f51b5"
android:gravity="center"
android:text="NAME"
android:textColor="#ff000000"
android:textStyle="bold" />
<TextView
android:id="#+id/textView4"
android:layout_width="128dp"
android:layout_height="30dp"
android:layout_below="#+id/Background_for_buttons"
android:layout_centerHorizontal="true"
android:layout_weight="1"
android:background="#803f51b5"
android:gravity="center"
android:text="PRICE"
android:textColor="#ff000000"
android:textStyle="bold" />
<TextView
android:id="#+id/text_view_test"
android:layout_width="128dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#+id/Background_for_buttons"
android:layout_weight="1"
android:background="#803f51b5"
android:gravity="center"
android:text="CHANGE 24H."
android:textColor="#ff000000"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Your ListView has a fixed height and is aligned with parent's bottom. Your LinearLayout with headers is put on top of the ListView. So based on vertical resolution of the screen there may or may not be a gap between the LinearLayout and the top of the screen. More specifically, if the screen is taller than 30+385 dp you'll see a gap.
What you probably want to do is align the headers layout with the top of the parent, align the list to the bottom of the headers and make lists's height "match_parent"
Edit: didn't notice the refresh button. You may also need to put
android:layout_above="#+id/refresh_button"
on the ListView
I have an image that sits within a relative view, I'd like to set this so that it aligns with the bottom of the view, at the moment it simply centres itself (see screen grab below). I can achieve this alignment by setting a top margin however that doesn't seem right to me as this could vary depending on the device used. Is there a way to simply achieve this? (current screen grab and code below)
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="0.7"
android:background="#color/main_bg_color">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src = "#drawable/feature_compliment"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="0dp" />
<Button
android:id="#+id/exit_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/home"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="#android:color/black"
android:alpha="0.5" />
<Button
android:id="#+id/sign_btn"
android:layout_width="90dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="#string/sign"
android:background="#color/primary_button_color"
android:textColor="#color/white"
android:textSize="15sp"/>
</RelativeLayout>
Change
android:layout_width="match_parent"
android:layout_height="match_parent"
to
android:layout_width="wrap_content"
android:layout_height="wrap_content"
set android:layout_height to "wrap_content"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="0.3"
android:background="#color/colorPrimary">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="0.7"
android:background="#color/colorPrimary">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src = "#drawable/sample_background"
android:layout_alignParentBottom="true"
/>
<Button
android:id="#+id/exit_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="#string/home"
android:textStyle="bold"
android:textSize="15sp"
android:textColor="#android:color/black"
android:alpha="0.5" />
<Button
android:id="#+id/sign_btn"
android:layout_width="90dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="#string/signUp"
android:background="#color/colorPrimaryLight"
android:textColor="#color/text_color_white"
android:textSize="15sp"/>
</RelativeLayout>
I have to place two edittext and a button on the same line.
The two edittext should have the same width, the largest possible so to fill the line. The button should be on the right.
It should be like this:
Edittext_______________________ EditText_________________________ Button
I post some relative code, which for the moment is not working.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="#+id/new_formulas"
>
<Button
android:textSize="30dp"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/add"
android:id="#+id/add"
/>
<EditText
android:textSize="30dp"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:hint="#string/add_hint"
android:id="#+id/add_hint2"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
/>
<EditText
android:textSize="30dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="#string/add_hint"
android:id="#+id/add_hint"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#id/add"/></RelativeLayout>
Try following Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/button"
android:layout_alignParentLeft="true"
android:orientation="horizontal"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="User"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Pass"/>
</LinearLayout>
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Click"/>
</RelativeLayout>
Please try this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/new_formulas"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="#+id/add_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="100dp"
android:hint="Hint"
android:textSize="30dp" />
<EditText
android:id="#+id/add_hint2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/add_hint"
android:minWidth="100dp"
android:hint="hint2"
android:textSize="30dp" />
<Button
android:id="#+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/add_hint2"
android:text="Add"
android:textSize="30dp" />
</RelativeLayout>
Use Linear Layout :
<LinearLayout
android:id="#+id/new_formulas"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:id="#+id/add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/add"
android:textSize="30dp" />
<EditText
android:id="#+id/add_hint2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:hint="#string/add_hint"
android:textSize="30dp" />
<EditText
android:id="#+id/add_hint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="#string/add_hint"
android:textSize="30dp" />
</LinearLayout>
Try this
<LinearLayout
android:id="#+id/new_formulas"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<EditText
android:id="#+id/add_hint2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="40"
android:gravity="center_horizontal"
android:hint="#string/add_hint"
android:textSize="30dp" />
<EditText
android:id="#+id/add_hint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#id/add"
android:layout_weight="40"
android:hint="#string/add_hint"
android:textSize="30dp" />
<Button
android:id="#+id/add"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:layout_alignParentRight="true"
android:text="#string/add"
android:textSize="30dp" />
</LinearLayout>
You can adjust weight acoording to your need but remember sum of all weight must be 100
You can achieve what you want using PercentRelativeLayout from the new Percent Support Library. It inherits all the alignment attributes of RelativeLayout and lets you specify dimensions and margins in percentages. Basically a counterpart of the layout_weight attribute of LinearLayout. Read Joanna Smith's #proTip for more info.
First add the dependency in app/build.gradle
dependencies {
...
compile 'com.android.support:percent:23.0.1'
}
Then change your code like this:
<android.support.percent.PercentRelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/new_formulas">
<Button
android:textSize="30dp"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/add" />
<EditText
android:textSize="30dp"
android:layout_toLeftOf="#id/add"
app:layout_widthPercent="40%"
android:layout_height="wrap_content"
android:id="#+id/add_hint" />
<EditText
android:textSize="30dp"
android:layout_toLeftOf="#id/add_hint"
app:layout_widthPercent="40%"
android:layout_height="wrap_content"
android:id="#+id/add_hint2" />
</android.support.percent.PercentRelativeLayout>
Some tips:
Use sp instead of dp for textSize
Always format the code (ctrl + alt + L) before posting. Makes it more readable.
I was trying to get two images side by side inside my LinearLayout. I tried setting my layout weight to 1 as suggested by many other posts I saw here for both views but to no avail. The imageViews in question are the ones with the ID rainfall and wind. What am I doing wrong here? I even tried wrapping them inside a relative layout and it did not work. This is what they look like with the code below: I just want the umbrellas to be side by side instead of one being slightly below the other one? Any ideas?
<Button
android:layout_width="wrap_content"
android:id="#+id/city"
android:layout_gravity="center"
android:gravity="center"
android:layout_height="wrap_content"
android:background="#null"
android:onClick="location"/>
<ImageButton
android:id="#+id/condition"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#null"
android:onClick="sendMessage"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtCondition"
android:gravity="center"
android:layout_gravity="center" />
<TextView
android:layout_width="wrap_content"
android:id="#+id/temp"
android:layout_gravity="center"
android:gravity="center"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/maxMin"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/highTemp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:id="#+id/wind"
android:src="#drawable/ic_umbrella"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="start" />
<ImageView
android:id="#+id/rainfall"
android:src="#drawable/ic_umbrella"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="end" />
<TextView
android:id="#+id/secDay"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/weekHigh"
android:layout_gravity="bottom|center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Try to put them inside a LinearLayout :
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/wind"
android:src="#drawable/ic_umbrella"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start" />
<ImageView
android:id="#+id/rainfall"
android:src="#drawable/ic_umbrella"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="end" />
</LinearLayout>
I have two buttons inside a linear layout which have same properties defined. But to my surprise, both have different height. Please see the xml code below
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="5dp" >
<ImageView
android:id="#+id/imgUser"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:adjustViewBounds="true"
android:src="#drawable/default_people_thumb" />
<TextView
android:id="#+id/tvUploadHeader"
style="#style/Text.Quaternary.Small.Bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choose_a_profile_photo" />
<TextView
android:id="#+id/tvDescription"
style="#style/Text.Quaternary.ExtraSmall.Bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="#string/photo_upload_initial" />
<Button
android:id="#+id/btnChoosePhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#drawable/login_button_selector"
android:text="#string/choose_photo_from_gallery" />
<Button
android:id="#+id/btnSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#drawable/login_button_selector"
android:text="#string/choose_photo_from_gallery" />
</LinearLayout>
Can you please help me to have the same height. I am wondering as to how both behaves differently. Also added includeFontPadding for the button. But no hope :(.
Your background drawables have different padding or height. check #drawable/btn_large_gray and #drawable/login_button_selector
put both the button inside linear layout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="5dp" >
<ImageView
android:id="#+id/imgUser"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:adjustViewBounds="true"
android:src="#drawable/default_people_thumb" />
<TextView
android:id="#+id/tvUploadHeader"
style="#style/Text.Quaternary.Small.Bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choose_a_profile_photo" />
<TextView
android:id="#+id/tvDescription"
style="#style/Text.Quaternary.ExtraSmall.Bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="#string/photo_upload_initial" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="5dp" >
<Button
android:id="#+id/btnChoosePhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#drawable/login_button_selector"
android:text="#string/choose_photo_from_gallery" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="5dp" >
<Button
android:id="#+id/btnSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#drawable/btn_large_gray"
android:text="#string/skip" />
</LinearLayout>
</LinearLayout>
and adjust both linear layouts as you like it
Try defining property android:layout_weight for each element in your LinearLayout, so they can have the same height.
For example :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="5dp" >
<ImageView
android:id="#+id/imgUser"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_weight="1"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:adjustViewBounds="true"
android:src="#drawable/default_people_thumb" />
<TextView
android:id="#+id/tvUploadHeader"
style="#style/Text.Quaternary.Small.Bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/choose_a_profile_photo" />
<TextView
android:id="#+id/tvDescription"
style="#style/Text.Quaternary.ExtraSmall.Bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="#string/photo_upload_initial" />
<Button
android:id="#+id/btnChoosePhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp"
android:background="#drawable/login_button_selector"
android:text="#string/choose_photo_from_gallery" />
<Button
android:id="#+id/btnSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="5dp"
android:background="#drawable/login_button_selector"
android:text="#string/choose_photo_from_gallery" />
</LinearLayout>
The idea is to give as much space to each element. Your LinearLayout contains different elements so by choosing wrap_content in the android:layout_height and android:layout_width, space available will be allocated for each element added. And as you TextViews and Buttons are not the same...
Hope it'll help
You are using different style for both the buttons,
i.e. "#style/Text.Quaternary.Small.Bold" and "#style/Text.Quaternary.ExtraSmall.Bold" you should use only one style for both buttons