0

I have custom row for data representation but in first text when text is long it is in two lines but second line is half cut by height (like text view doesn't wrap content)

<TextView
    android:id="@+id/txtDate"
    android:layout_width="0dip"
    android:layout_height="wrap_content"
    android:singleLine="false"
    android:maxLines="3"
    style="@style/row"
    android:layout_weight="1"/>

<TextView
    android:id="@+id/txtTime"
    android:layout_width="0dip"
    android:layout_height="wrap_content"
    style="@style/row"
    android:layout_weight="1"/>


<Button
    android:id="@+id/imbDetail"
    android:layout_width="36dip"
    android:layout_height="36dip"
    android:background="@drawable/selector_detail_arrow" />

How to make that has height enough to show all content ?

Andy G
  • 19,232
  • 5
  • 47
  • 69
Damir
  • 54,277
  • 94
  • 246
  • 365

1 Answers1

0

your height is wrap content which means it'll wrap them to give the shortest view of text. Use fill_parent to display everything.

android:layout_height="fill_parent"

Either attribute can be applied to View's (visual control) horizontal or vertical size. It's used to set a View or Layouts size based on either it's contents or the size of it's parent layout rather than explicitly specifying a dimension.

fill_parent (deprecated and renamed MATCH_PARENT in API Level 8 and higher)

Setting the layout of a widget to fill_parent will force it to expand to take up as much space as is available within the layout element it's been placed in. It's roughly equivalent of setting the dockstyle of a Windows Form Control to Fill.

Setting a top level layout or control to fill_parent will force it to take up the whole screen.

wrap_content

Setting a View's size to wrap_content will force it to expand only far enough to contain the values (or child controls) it contains. For controls -- like text boxes (TextView) or images (ImageView) -- this will wrap the text or image being shown. For layout elements it will resize the layout to fit the controls / layouts added as its children.

It's roughly the equivalent of setting a Windows Form Control's Autosize property to True.

check this answer: Here

Community
  • 1
  • 1
Ahmed Ekri
  • 4,601
  • 3
  • 23
  • 42