Reputation: 15734
I want my rows to be 50dp high, but for some reason it will only wrap_content
.
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/master_selector" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_marginTop="3dp"
android:contentDescription="Category" >
</ImageView>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:text="@+id/label"
android:textColor="#ebebeb"
android:textSize="25sp" >
</TextView>
</LinearLayout>
I cannot figure out WHY the 50dp is having no effect? It's on a regular ListView
Edit: Screenshot:
As you see, the rows are close together. The text is only 25sp (on regular text size).
Edit: Changing TextView
height to 50dp
and gravity
to center_vertical
fixes it.
Upvotes: 0
Views: 121
Reputation: 25864
The layout values of an inflated view can be easily forgotten in some implementations (Usually because they're added with a specified LayoutParam object as is the case in ListView
).
You can fix this by adding one of the childrens heights to be 50dp which will correctly display.
Upvotes: 1