I have the followin xml where I want imageview and then two textview and then imageview again, but it does not work properly.
Here is what I planned to have:
Here is what I am getting:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:clickable="true"
android:onClick="userProfileDetailAction"
android:id="#+id/userProfileDetail"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<com.example.eyeniaras.satdostum.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_weight="0.3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/circle_shape"
app:civ_border_width="0.2dp"
app:civ_border_color="#color/dark"
android:id="#+id/userImage"
android:scaleType="centerCrop"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.6">
<TextView
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:layout_weight="1"/>
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:text = "45 days ago"
android:layout_weight="1"/>
</LinearLayout>
<ImageView
android:id="#+id/userClick"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.1"
android:background="#drawable/list_arrow" />
</LinearLayout>
inside linearlayout must have 0 width
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:weightSum="100"
android:layout_weight="60">
Inside linearlayout second chance follow code.
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="60">
i was changed your code check it
change image View as you require and replace your code with this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:clickable="true"
android:weightSum="100"
android:onClick="userProfileDetailAction"
android:id="#+id/userProfileDetail"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<ImageView
android:layout_weight="20"
android:layout_width="0dp"
android:layout_height="match_parent"
android:id="#+id/userImage"
android:src="#android:drawable/btn_star_big_on"
android:scaleType="centerCrop"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:weightSum="100"
android:gravity="center_vertical"
android:layout_weight="60">
<TextView
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center" android:text="hey hi"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:textStyle="bold"
android:layout_weight="50"/>
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:text = "45 days ago"
android:textStyle="bold"
android:layout_weight="50"/>
</LinearLayout>
<ImageView
android:id="#+id/userClick"
android:layout_width="0dp"
android:layout_height="match_parent"
android:src="#android:drawable/btn_star"
android:layout_weight="20" /></LinearLayout>
it is because of width make it 0dp..copy the bellow code it works perfect
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:clickable="true"
android:weightSum="100"
android:onClick="userProfileDetailAction"
android:id="#+id/userProfileDetail"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<com.example.eyeniaras.satdostum.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_weight="20"
android:layout_width="0dp"
android:layout_height="10dp"
android:background="#drawable/circle_shape"
app:civ_border_width="0.2dp"
app:civ_border_color="#color/dark"
android:id="#+id/userImage"
android:scaleType="centerCrop"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:orientation="vertical"
android:layout_height="match_parent"
android:weightSum="100"
android:layout_weight="60">
<TextView
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:textStyle="bold"
android:layout_weight="50"/>
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:text = "45 days ago"
android:textStyle="bold"
android:layout_weight="50"/>
</LinearLayout>
<ImageView
android:id="#+id/userClick"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_weight="20"
android:background="#drawable/list_arrow" />
</LinearLayout>
You can use The following Code:-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="4" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical"
android:weightSum="1" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".5"
android:gravity="center"
android:text="hello" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".5"
android:gravity="center"
android:text="hello" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/ic_launcher" />
</LinearLayout>
</LinearLayout>
This is the perfect scenario to make use of PercentageRelativeLayout. The best thing about this layout is that you can use percentage based dimensions which is super easy.
Here is a quick example of it,
<android.support.percent.PercentRelativeLayout
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="match_parent">
<ImageView
app:layout_widthPercent="50%"
app:layout_heightPercent="50%"
app:layout_marginTopPercent="25%"
app:layout_marginLeftPercent="25%"/>
</android.support.percent.PercentFrameLayout>
This is very simple and intuitive to use and is optimized for various use cases too.
I've taken your code and stripped it down. The following, at least in studio design, has the layout you've described. Perhaps progressively change/adapt this; checking as you go along that it maintains the desired layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:clickable="true"
android:weightSum="100"
android:onClick="userProfileDetailAction"
android:id="#+id/userProfileDetail"
android:paddingTop="5dp"
android:paddingBottom="5dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="500dp"
android:layout_height="100dp"
android:weightSum="100"
android:layout_weight="60">
<TextView
android:id="#+id/userName"
android:layout_width="500dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:textStyle="bold"
android:layout_weight="50"/>
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="500dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:text = "45 days ago"
android:textStyle="bold"
android:layout_weight="50"/>
</LinearLayout>
<ImageView
android:id="#+id/userClick"
android:layout_width="100dp"
android:layout_height="100dp" />
</LinearLayout>
Note I've done away with things like width="match_parent", which may have been an issue, as an example.
According to Image.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/userProfileDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:onClick="userProfileDetailAction"
android:orientation="horizontal"
android:padding="5dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<com.example.eyeniaras.satdostum.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/userImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/circle_shape"
android:scaleType="centerCrop"
app:civ_border_color="#color/dark"
app:civ_border_width="0.2dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/userName"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#ffffff"
android:text="45 days ago"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#ffffff"
android:gravity="center"
android:text="45 days ago"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="#+id/userClick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="20"
android:background="#drawable/list_arrow"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
Don't use weightsum at all and then assign weight according to requirement to all main views.It will definitely work.why to make things complex.I have done it for you.Check it below.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:clickable="true"
android:onClick="userProfileDetailAction"
android:id="#+id/userProfileDetail"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<com.example.eyeniaras.satdostum.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_weight="0.2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#drawable/circle_shape"
app:civ_border_width="0.2dp"
app:civ_border_color="#color/dark"
android:id="#+id/userImage"
android:scaleType="centerCrop"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.6">
<TextView
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:textStyle="bold"
android:layout_weight="1"/>
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:background="#ffffff"
android:textSize="18sp"
android:text = "45 days ago"
android:textStyle="bold"
android:layout_weight="1"/>
</LinearLayout>
<ImageView
android:id="#+id/userClick"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold"
android:layout_weight="0.2"
android:background="#drawable/list_arrow" />
</LinearLayout>
you need to use android:layout_weight for both images and textview so here is solution,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/userProfileDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:clickable="true"
android:onClick="userProfileDetailAction"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:weightSum="5">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.4">
<com.example.eyeniaras.satdostum.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/userImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/circle_shape"
android:scaleType="centerCrop"
app:civ_border_color="#color/dark"
app:civ_border_width="0.2dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#ffffff"
android:gravity="center"
android:text="Hi"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#ffffff"
android:gravity="center"
android:text="45 days ago"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.6">
<ImageView
android:id="#+id/userClick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="20"
android:background="#drawable/list_arrow"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100"
android:layout_weight="60">
android:layout_width="match_parent",this layout's width is match_parent,so it filled up everything else,change to wrap_content,just like
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/userProfileDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="true"
android:onClick="userProfileDetailAction"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:weightSum="100" >
<ImageView
android:id="#+id/userImage"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="20"
android:background="#drawable/ic_launcher"
android:scaleType="centerCrop"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:weightSum="100"
android:layout_weight="60"
android:orientation="vertical"
>
<TextView
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="50"
android:background="#ffffff"
android:text="46 days ago"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/userRegistrationDate"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="50"
android:background="#ffffff"
android:text="45 days ago"
android:textColor="#android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="#+id/userImage"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="20"
android:background="#drawable/ic_launcher"
android:scaleType="centerCrop"
/>
</LinearLayout>
use can following thing for weight ..i think this answer is helpful for you..
this xml
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="30"
android:background="#drawable/background"
android:gravity="center" >
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="#drawable/images" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="40" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:background="#drawable/background"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Firstname" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:background="#drawable/background"
android:gravity="center" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lastname" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="30"
android:background="#drawable/background"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/download" />
</LinearLayout>
</LinearLayout>
and this code for background past in drawable/background
<?xml version="1.0" encoding="UTF-8"?>
<!-- res/drawable/rounded_edittext.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="12dp"
android:shape="rectangle" >
<solid android:color="#FFFFFF" />
<stroke
android:width="0.3dp"
android:color="#797979" />`enter code here`
</shape>
Related
I've searched through the site but haven't found a similar question. I have finished making this layout, and then I proceeded to make some changes in my code (not regarding the layout), and when I came back to content_main.xml, the layout decided not to render. The solution seems to be when I remove this line:
tools:showIn="#layout/activity_main"
Then the layout renders, of course, without the toolbar. The layout is slightly complicated, but it worked fine up until now, and I haven't changed anything in the toolbar layout. Where should I look? In the content_main.xml,activity_main, or where? Also, I can post whatever piece of code might be relevant to this problem. But I do not know what is relevant and what isn't, so instead of posting 500 xml lines of code, (plus 2600 lines in java), I'm not going to post until someone tells me what might be the problem.
EDIT
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.example.samprocreativecenter.nfc.MainActivity"
android:orientation="horizontal"
android:background="#819fba">
<!-- tools:showIn="#layout/activity_main"
-->
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:background="#drawable/ekran"
android:clickable="false">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="end"
android:id="#+id/txtStatus"
android:textColor="#ffffff"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:textSize="28sp"
android:textColor="#ffffff"
android:id="#+id/editUnos"
android:fontFamily="sans-serif-thin"
android:gravity="bottom|end"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:id="#+id/layoutTasteri"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img1"
android:src="#drawable/p1"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img2"
android:src="#drawable/p2"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img3"
android:src="#drawable/p3"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img4"
android:src="#drawable/p4"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img5"
android:src="#drawable/p5"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img6"
android:src="#drawable/p6"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img7"
android:src="#drawable/p7"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img8"
android:src="#drawable/p8"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img9"
android:src="#drawable/p9"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/imgNazad"
android:src="#drawable/delete"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/img0"
android:src="#drawable/p0"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/imgEnter"
android:src="#drawable/enter"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="30dp"
android:layout_height="match_parent"
android:src="#drawable/linija"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:visibility="gone"
android:id="#+id/layoutOtvorenListView"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="18dp"
android:id="#+id/txtSmanjiListView"
android:background="#607b9a"
android:text="Info panel"
android:textColor="#d9e8e7"/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/listViewOtvoreni"
android:stackFromBottom="true">
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:id="#+id/layoutSredina">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<TextClock
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="60sp"
android:id="#+id/textClock"
android:textColor="#ffffff"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="27sp"
android:id="#+id/txtDatum"
android:gravity="center"
android:textColor="#ffffff"
android:fontFamily="sans-serif-thin"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:id="#+id/layoutSredinaPodesavanja"
android:visibility="gone"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/imgUspesnaVerifikacija"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:text="Domen"
android:id="#+id/domen"
android:textColor="#ffffff"
android:textSize="12sp"/>
<EditText
android:layout_below="#+id/domen"
android:layout_marginTop="2dp"
android:layout_width="match_parent"
android:layout_height="27dp"
android:textColor="#ffffff"
android:background="#drawable/unos_polje_neaktivno"
android:textColorHint="#a6bbce"
android:singleLine="true"
android:maxLines="1"
android:id="#+id/editDomen"/>
<TextView
android:layout_below="#+id/editDomen"
android:layout_marginTop="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/server"
android:text="Adresa servera"
android:textColor="#ffffff"
android:textSize="12sp"/>
<EditText
android:layout_below="#+id/server"
android:layout_marginTop="2dp"
android:layout_width="match_parent"
android:layout_height="27dp"
android:background="#drawable/unos_polje_neaktivno"
android:textColor="#ffffff"
android:maxLines="1"
android:textColorHint="#a6bbce"
android:id="#+id/editServer"/>
<ImageView
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_gravity="end"
android:id="#+id/imgVerifikacija"
android:src="#drawable/verifikacija"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.7"
android:orientation="vertical"
android:id="#+id/layoutSredinaDole"
android:visibility="visible">
<Spinner
android:layout_width="0dp"
android:layout_height="0dp"
android:id="#+id/spnMestoTroska"
android:spinnerMode="dropdown"
android:layout_gravity="start"
>
</Spinner>
<TextView
android:layout_width="120dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="#drawable/mesto_troska"
android:id="#+id/txtSpinner"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="18dp"
android:background="#drawable/rsz_prologin_pocetna_1"
android:id="#+id/txtListView"/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/listView">
</ListView>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/layoutDesniPodesavanja"
android:visibility="gone"
>
<TextView
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="Rezim sinhronizacije"
android:textSize="13sp"
android:textColor="#a6bbce"
android:id="#+id/rezim"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:textSize="13sp"
android:textColor="#ffffff"
android:id="#+id/txtSinhronizacija"
android:layout_below="#+id/rezim"/>
<ImageView
android:layout_marginStart="5dp"
android:layout_width="55dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/rezim"
android:id="#+id/imgSinhronizuj"
android:src="#drawable/sinhronizuj"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:singleLine="true"
android:layout_below="#+id/imgSinhronizuj"
android:textSize="9sp"
android:text="Sinhronizuj"
android:layout_alignStart="#+id/imgSinhronizuj"
android:layout_marginStart="8dp"
android:id="#+id/sinhronizuj"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rezim rada terminala:"
android:textColor="#a6bbce"
android:layout_marginStart="10dp"
android:textSize="13sp"
android:layout_below="#+id/sinhronizuj"
android:layout_marginTop="15dp"
android:id="#+id/rezimrada"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtTipRV"
android:layout_below="#+id/rezimrada"
android:layout_alignStart="#+id/rezimrada"
android:layout_marginStart="10dp"
android:textColor="#ffffff"
/>
<ImageView
android:layout_width="55dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="15dp"
android:layout_marginBottom="15dp"
android:id="#+id/imgOdustani"
android:src="#drawable/odustani" />
<ImageView
android:layout_width="55dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="15dp"
android:layout_marginStart="15dp"
android:id="#+id/imgSacuvaj"
android:src="#drawable/snimi"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtKoristiMT"
android:layout_below="#+id/txtTipRV"
android:layout_alignStart="#+id/txtTipRV"
android:textColor="#ffffff"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtGPS"
android:layout_below="#+id/txtKoristiMT"
android:layout_alignStart="#+id/txtKoristiMT"
android:textColor="#ffffff"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtSlika"
android:layout_below="#+id/txtGPS"
android:layout_alignStart="#+id/txtGPS"
android:textColor="#ffffff"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtDozTestaturu"
android:layout_below="#+id/txtSlika"
android:layout_alignStart="#+id/txtSlika"
android:textColor="#ffffff"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/layoutDesni"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.9">
<ImageView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:id="#+id/imgDolazak"
android:src="#drawable/dolazak"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/imgOdlazak"
android:src="#drawable/odlazak"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.6">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/imgPauza"
android:src="#drawable/pauza"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/imgTeren"
android:src="#drawable/rad_teren"/>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/imgPrivatno"
android:src="#drawable/privatno"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Pauza"
android:textColor="#ffffff"
android:textSize="10sp"
android:src="#drawable/pauza"
android:gravity="center"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/rad_teren"
android:text="Rad na terenu"
android:gravity="center"
android:textColor="#ffffff"
android:textSize="10sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/privatno"
android:text="Privatno odsutan"
android:gravity="center"
android:textColor="#ffffff"
android:textSize="10sp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.17">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="70dp"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:id="#+id/imgView"
android:layout_marginStart="5dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginStart="1dp">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textColor="#a6bbce"
android:text="Poslednji prijavljeni"
android:textSize="12sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/txtPoslenjiUpisani"
android:textColor="#ffffff"
android:text=""
android:textSize="12sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textColor="#a6bbce"
android:text="Pozicija"
android:textSize="12sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/txtPoslednjeMestoTroska"
android:textColor="#ffffff"
android:text=""
android:textSize="12sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textColor="#a6bbce"
android:text="Vreme"
android:textSize="12sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textColor="#ffffff"
android:id="#+id/txtPoslenjeVreme"
android:text=""
android:textSize="12sp"/>
</LinearLayout>
</LinearLayout>
<TextureView
android:layout_width="0.1dp"
android:layout_height="0.1dp"
android:id="#+id/texture"
android:layout_gravity="center"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.6"
android:layout_marginTop="4dp">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.9"
android:id="#+id/imgScrollLevo"
android:src="#drawable/levo"/>
<HorizontalScrollView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="1dp"
android:layout_weight="5"
android:id="#+id/horScrollView"
android:gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:id="#+id/layoutZaposleni"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.9"
android:id="#+id/imgScrollDesno"
android:src="#drawable/desno"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
And yes, I am aware that nested weights can be an issue, but this is still a test build. All the drawables exist and work.
I have 4 LinearLayout with a layout_weight of 0.25 (each one of them uses 25% of the screen height), the first 3 LinearLayout contains an ImageView and a RelativeLayout with a layout_weight of 0.5 (they both take 50% of the LinearLayout width) and they work fine, the problem occurs on the last LinearLayout which contains 2 RelativeLayout, this is the structure:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0"
android:layout_weight=".25">
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/white">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/icon_news"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:layout_above="#+id/newsTextView"
/>
<TextView
android:id="#+id/newsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="News"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:textColor="#color/mainBlue"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/white">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/icon_contacts"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:layout_above="#+id/contactTextView"
/>
<TextView
android:id="#+id/contactTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Contatti"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:textColor="#color/mainBlue"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
</LinearLayout>
This LinearLayout doesn't work, it doesn't take the 25% height of the screen and it's just not visible.. Is it a problem with RelativeLayout with layout_weight? what should I do to fix this?
EDIT
This is the whole XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:pew="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0"
android:layout_weight=".25">
<ImageView
android:layout_height="wrap_content"
android:layout_weight=".5"
android:layout_width="0dip"
android:src="#drawable/img"
android:scaleType="centerCrop"/>
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/mainBlue">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sezione 1"
android:gravity="left"
android:layout_centerInParent="true"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0"
android:layout_weight=".25">
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/mainBlue">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sezione 2"
android:gravity="left"
android:layout_centerInParent="true"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
<ImageView
android:layout_height="wrap_content"
android:layout_weight=".5"
android:layout_width="0dip"
android:src="#drawable/img"
android:scaleType="centerCrop"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0"
android:layout_weight=".25">
<ImageView
android:layout_height="wrap_content"
android:layout_weight=".5"
android:layout_width="0dip"
android:src="#drawable/img"
android:scaleType="centerCrop"/>
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/mainBlue">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sezione 1"
android:gravity="left"
android:layout_centerInParent="true"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1.0"
android:layout_weight=".25">
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/white">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/icon_news"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:layout_above="#+id/newsTextView"
/>
<TextView
android:id="#+id/newsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="News"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:textColor="#color/mainBlue"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
android:background="#color/white">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/icon_contacts"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:layout_above="#+id/contactTextView"
/>
<TextView
android:id="#+id/contactTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Contatti"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:textColor="#color/mainBlue"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Add Linear Layout as Root Layout with weightSum 1.
Refer this.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pew="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:orientation="horizontal"
android:weightSum="1.0">
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:scaleType="centerCrop"
android:src="#mipmap/ic_launcher" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#FFF">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="left"
android:text="Sezione 1"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:orientation="horizontal"
android:weightSum="1.0">
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#FFF">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="left"
android:text="Sezione 2"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:scaleType="centerCrop"
android:src="#mipmap/ic_launcher" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:orientation="horizontal"
android:weightSum="1.0">
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:scaleType="centerCrop"
android:src="#mipmap/ic_launcher" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#FFF">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="left"
android:text="Sezione 1"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.25"
android:orientation="horizontal"
android:weightSum="1.0">
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#FFF">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_above="#+id/newsTextView"
android:layout_centerHorizontal="true"
android:scaleType="centerInside"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/newsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="News"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#FFF">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_above="#+id/contactTextView"
android:layout_centerHorizontal="true"
android:scaleType="centerInside"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/contactTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Contatti"
android:textColor="#000"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
hey I tested your code is it seems there is problem in hight you gave to each 4 child layout.
just replace
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:orientation="horizontal"
android:weightSum="1.0" >
with
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".25"
android:orientation="horizontal"
android:weightSum="1.0" >
and do same for all 4 child views.
For reference
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:pew="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".25"
android:orientation="horizontal"
android:weightSum="1.0" >
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:scaleType="centerCrop"
android:src="#drawable/cat1" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#android:color/holo_blue_bright" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="left"
android:text="Sezione 1"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".25"
android:orientation="horizontal"
android:weightSum="1.0" >
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#android:color/holo_blue_bright" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="left"
android:text="Sezione 2"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:scaleType="centerCrop"
android:src="#drawable/cat2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".25"
android:orientation="horizontal"
android:weightSum="1.0" >
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:scaleType="centerCrop"
android:src="#drawable/cat3" />
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#android:color/holo_blue_bright" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="left"
android:text="Sezione 1"
android:textColor="#fff"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".25"
android:orientation="horizontal"
android:weightSum="1.0" >
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#fff" >
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_above="#+id/newsTextView"
android:layout_centerHorizontal="true"
android:scaleType="centerInside"
android:src="#drawable/icon" />
<TextView
android:id="#+id/newsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="News"
android:textColor="#android:color/holo_blue_bright"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".5"
android:background="#fff" >
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_above="#+id/contactTextView"
android:layout_centerHorizontal="true"
android:scaleType="centerInside"
android:src="#drawable/icon" />
<TextView
android:id="#+id/contactTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Contatti"
android:textColor="#android:color/holo_blue_bright"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Happy coding.
Use below code to solve this issue:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:orientation="horizontal"
android:weightSum="1.0"
android:layout_weight=".25">
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:layout_above="#+id/newsTextView"
/>
<TextView
android:id="#+id/newsTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="News"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_height="match_parent"
android:layout_weight=".5"
android:layout_width="0dip"
>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_centerHorizontal="true"
android:layout_above="#+id/contactTextView"
/>
<TextView
android:id="#+id/contactTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Contatti"
android:gravity="center_horizontal"
android:layout_centerInParent="true"
android:textSize="20sp"
android:textStyle="bold"
android:layout_margin="10dp"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
I want to do this:
The problem: all of the layout is contain by ScrollView into a LinearLayout and at the bottom must be the buttons of the stepper. To do that i used layout_weight to locating the elements in the space how i want.
Here is my XML code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:fillViewport="true"
android:background="#drawable/shape_fondo"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:src="#mipmap/indicador_wizzard2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Días de ingesta"
android:layout_marginBottom="6dp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="12dp"
android:layout_marginLeft="12dp"
android:weightSum="49">
<ToggleButton
android:id="#+id/lunes"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Lu"
android:textOff="Lu"/>
<ToggleButton
android:id="#+id/martes"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Ma"
android:textOff="Ma"/>
<ToggleButton
android:id="#+id/miercoles"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Mie"
android:textOff="Mie"/>
<ToggleButton
android:id="#+id/jueves"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Jue"
android:textOff="Jue"/>
<ToggleButton
android:id="#+id/viernes"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Vie"
android:textOff="Vie"/>
<ToggleButton
android:id="#+id/sabado"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Sa"
android:textOff="Sa"/>
<ToggleButton
android:id="#+id/domingo"
android:layout_weight="7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/botonesdias"
android:textOn="Do"
android:textOff="Do"/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2.3"
android:id="#+id/contenedortitulito">
<TextView
android:id="#+id/titulohora"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_alignParentLeft="true"
android:text="Hora" />
<TextView
android:id="#+id/titulodosis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_alignParentRight="true"
android:text="Dosis"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="#+id/listview"
android:background="#color/azul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/contenedortitulito"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
style="#style/botones"
android:id="#+id/btn_cancelar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Atrás"
android:layout_gravity="center"/>
<Button
style="#style/botones"
android:id="#+id/btn_irapaso3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:text="Continuar"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
</ScrollView>
I do not quite understand the concept of layout weight. Can you explain me?
Thanks!
You Need to provide weightsum to parent layout first of all after that you can distribute weight accordingly..
i have provided example of screen in which i used weightsum and layout_weight.
You can apply layout weight on scrollview as well
Here is the code for sample screen.
You can ignore first relative layout.
Hope it Helps
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/whole_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="35dp"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".15"
android:background="#drawable/top"
android:orientation="horizontal"
android:weightSum="6">
<ImageView
android:id="#+id/ivHome"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/ll_home" />
<ImageView
android:id="#+id/ivTraderList"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/ll_traderlist_green" />
<ImageView
android:id="#+id/ivStatement"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/ll_statement_green" />
<ImageView
android:id="#+id/ivSummary"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/ll_summary_green" />
<ImageView
android:id="#+id/ivProduct"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/ll_product_green" />
<ImageView
android:id="#+id/ivLogout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/ll_logout" />
</LinearLayout>
<TextView
style="#style/TitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="#string/trader_list_str" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/lightGreen"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:id="#+id/etDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".495"
android:editable="false"
android:focusable="false"
android:gravity="center"
android:text="#string/date_str"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#color/white"
android:textStyle="bold" />
<View
android:layout_width="0dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_weight=".005"
android:background="#android:color/darker_gray" />
<EditText
android:id="#+id/etTime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".495"
android:editable="false"
android:focusable="false"
android:gravity="center"
android:text="#string/time_str"
android:textAppearance="?android:textAppearanceMedium"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".84"
android:orientation="vertical"
android:weightSum="1">
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".8" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".2"
android:orientation="vertical"
android:weightSum="2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#color/lightYellow"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:id="#+id/tvLabelTotal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight=".595"
android:gravity="center"
android:text="#string/total_str"
android:textAppearance="?android:textAppearanceMedium" />
<View
android:layout_width="0dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_weight=".01"
android:background="#android:color/darker_gray" />
<TextView
android:id="#+id/tvTotal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="1dp"
android:layout_weight=".395"
android:gravity="center" />
</LinearLayout>
<TextView
android:id="#+id/tvOrder"
style="#style/BtnStyle"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:onClick="placeOrder"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:text="#string/place_order_str" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/advtLabel"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentBottom="true"
android:background="#color/lightYellow"
android:orientation="horizontal" />
In the image above I want to move the textview containing bill microsoft under the image and the other textview. How can I do this?
I have written this layout right now.
<android.support.v7.widget.CardView
android:id="#+id/card_tracks"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_gravity="center"
android:layout_margin="16dp"
android:elevation="7dp">
<LinearLayout
android:id="#+id/main_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<ImageView
android:id="#+id/speaker_image"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="#drawable/default_user"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="#+id/speaker_name"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:gravity="center_vertical"
android:text="#string/placeholder_speaker_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold"/>
<TextView
android:id="#+id/speaker_designation"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:gravity="top"
android:text="#string/placeholder_speaker_designation"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/main_ll">
<TextView
android:id="#+id/speaker_bio"
android:layout_width="326dp"
android:layout_height="64dp"
android:layout_margin="10dp"
android:text="#string/placeholder_speaker_bio"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
Please use this
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/card_tracks"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_gravity="center"
android:layout_margin="16dp"
android:elevation="7dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/main_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<ImageView
android:id="#+id/speaker_image"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="#drawable/icon" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="#+id/speaker_name"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:gravity="center_vertical"
android:text="placeholder_speaker_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="#+id/speaker_designation"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:gravity="top"
android:text="placeholder_speaker_designation"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/speaker_bio"
android:layout_width="326dp"
android:layout_height="64dp"
android:layout_margin="10dp"
android:text="placeholder_speaker_bio"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
You just have to add:
android:orientation="vertical"
to your first LinearLayout, so TextViews can be draw below ImageView.
I am making an android app, i want to make a layout like below image.
How can i manage image and layout weight with color.
Try this..
<?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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="#+id/flag"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#1D63A1"
android:gravity="center"
android:padding="7dp"
android:text="#string/hello_world"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>