1

I have an XML to display items in the ListView. For some reason it looks like that:

enter image description here

I tried I think everything to fix it - paddings, different layout_width and layout_height... It still looks like this, sometimes even worse. Best case scenario was when I changed the title to textAppearanceSmall. But then I can barely see it. I also want to make the date and time texts below the title a bit bigger, and the pencil icon to be vertically aligned.

Here's the XML code of the item:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >

<ImageView
    android:id="@+id/icoNoteItem"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:contentDescription="@string/note_item_edit_icon_Description"
    android:src="@android:drawable/ic_menu_edit" />

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center_vertical"
        android:orientation="vertical"
        tools:ignore="UselessParent" >

        <TextView
            android:id="@+id/noteTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:singleLine="true"
            android:ellipsize="end" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/noteTime"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingRight="10dp"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textSize="8sp" />

            <TextView
                android:id="@+id/noteDate"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textSize="8sp" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

Where's the problem here? How can I fix it?

1 Answer 1

2

Setting property "android:layout_height" of second LinearLayout in the code you have given to "wrap_content" will do. I have run the program and its working fine after this change.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.