-1

I want to layout the following: A title using the 20% of the screen, and a group of images using the rest (80%) in which each image uses the same amount of space. All this is vertically. This is the code I am using

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="20"
    android:orientation = "vertical">
    <TextView
        android:id="@+id/titleTextView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="@string/dashboard_title"
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:gravity="center"/>
</LinearLayout>

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="80"
    android:orientation = "vertical">
    <ImageView
        android:id="@+id/logo1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/logo" 
        android:layout_weight= "33" />

    <ImageView
        android:id="@+id/logo2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/logo"
        android:layout_weight= "33"  />

    <ImageView
        android:id="@+id/logo3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/logo"
        android:layout_weight= "33" />
</LinearLayout>

This is however what I am getting

enter image description here

Which is not the desired layout (notice the title has more than the 20% of the screen height). Also, I am getting some warnings about performance issues using nested layout_weight

Community
  • 1
  • 1
José D.
  • 4,175
  • 7
  • 28
  • 47

1 Answers1

0

The problem was fixed just by setting

android:layout_height="0px"

José D.
  • 4,175
  • 7
  • 28
  • 47