How to fix It does not allow me to modify android: layout_height in a LinearLayout

1

I'm trying to change the height of the rows that would be displayed in a ExpandableListView , but I've modified the android: layout_height attribute with different values, when emulating changes are not noticed, it is as if it were always "wrap_content" , they are two Layouts and with both passes the same, if someone knows how to solve it, I appreciate the help.

Next the xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:layout_marginTop="2dp"
android:orientation="horizontal"
android:background="#ccaa4c">

<TextView
    android:id="@+id/list_item_cate_name"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:layout_marginLeft="10dp"
    android:textColor="#000f61"
    android:textStyle="bold"
    android:layout_weight="1"
    android:text="Categoria" />

<ImageView
    android:id="@+id/list_item_cate_arrow"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:layout_marginRight="16dp"
    android:src="@drawable/ic_arrow_down" />

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginBottom="0.8dp"
android:layout_marginTop="0.8dp"
android:orientation="horizontal"
android:gravity="center"
android:background="#142a46">

<ImageView
    android:id="@+id/list_item_scate_icon"
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:src="@mipmap/ic_launcher" />

<TextView
    android:id="@+id/list_item_name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="0dp"
    android:textSize="15sp"
    android:textColor="#ffffff"
    android:textStyle="bold"
    android:gravity="center_vertical"
    android:text="SubCategoria" />

    
asked by Ivan Alfredo 28.10.2017 в 22:32
source

1 answer

1

I have solved this by adding within each Layout a LinearLayout and to these I placed margin:

android:layout_marginTop="7dp" Y   android:layout_marginBottom="7dp"

With this I managed to make each row look wider:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginBottom="0.8dp"
android:layout_marginTop="0.8dp"
android:orientation="vertical"
android:gravity="center"
android:background="#142a46">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:layout_marginTop="7dp"
    android:layout_marginBottom="7dp">

    <ImageView
        android:id="@+id/list_item_scate_icon"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:src="@mipmap/ic_launcher" />

    <TextView
        android:id="@+id/list_item_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="0dp"
        android:textSize="15sp"
        android:textColor="#ffffff"
        android:textStyle="bold"
        android:gravity="center_vertical"
        android:text="SubCategoria" />

</LinearLayout>

    
answered by 31.10.2017 / 21:26
source