1

i have a xml file which i am trying to use in custom ListView. The xml file looks like below :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="5dp" >
    <ImageView
    android:id="@+id/imageView1"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:paddingRight="10dp"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="TextView"
    android:layout_toRightOf="@id/imageView1"
    android:textSize="25dp" 
    android:gravity="center"/>

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="10dp"
    android:layout_height="10dp"
    android:layout_alignBottom="@id/textView1"
    android:layout_alignParentRight="true"
    android:layout_marginRight="25dp"
    android:baseline="@id/imageView1"
    android:src="@drawable/offline" />
    </RelativeLayout>

i am inflating it with my custom listview but it is showing error inflateException

  02-28 15:50:08.363: E/AndroidRuntime(19777): android.view.InflateException: Binary XML file line #24: Error inflating class <unknown>
2
  • 1
    Post full xml code. And, what is on line number 24 Commented Feb 28, 2014 at 10:59
  • 3
    post your proper code that how you are inflating your xml in your custom adapter. Then one can solve your problem. Commented Feb 28, 2014 at 10:59

2 Answers 2

2
 android:baseline="@id/imageView1"

android:baseline wants a dimension

From the doc:

The offset of the baseline within this view. [dimension]

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

Comments

1

Put your children in proper container like this.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/realtivelayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:marginRight="10dp"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/imageView1"
    android:gravity="center"
    android:text="TextView"
    android:textSize="25dp" />

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="10dp"
    android:layout_height="10dp"
    android:layout_alignBottom="@id/textView1"
    android:layout_alignParentRight="true"
    android:layout_marginRight="25dp"
    android:src="@drawable/offline" />

</RelativeLayout>

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.