Sunday, 15 September 2013

android - How to inflate the icon image in my layout? -



android - How to inflate the icon image in my layout? -

i trying add together little home icon image top of list view.below can see code of adapter. works setting dynamic text fails when want add together image.

i not runtime error, images aren't loaded.

the images referenced 35x35 png file.

how implement this? im new android. please guide me.

layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service); viewlist = nexttopic.this.getlayoutinflater().inflate(r.layout.activity_nexttopic, null); dialogmarketlist = new dialog(nexttopic.this); dialogmarketlist.requestwindowfeature(window.feature_no_title); dialogmarketlist.setcontentview(viewlist); dialogmarketlist.show(); lvfordialog = (listview) viewlist.findviewbyid(r.id.list_view); lvfordialog.settranscriptmode(listview.transcript_mode_always_scroll); arrayadapter<string> adapter = (new arrayadapter<string>(nexttopic.this, r.layout.row_topic, r.id.child_row,tnamelist)); imageview home = (imageview) findviewbyid(r.id.hme); lvfordialog.setadapter(adapter);

row_topic xml file

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightsum="1"> <imageview android:id="@+id/hme" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_above="@+id/child_row" android:src="@drawable/homex"/> <textview android:id="@+id/child_row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textcolor="@android:color/white" android:gravity="center_vertical" android:paddingleft="6dip" android:minheight="?android:attr/listpreferreditemheight" android:background="@drawable/bg"/> </relativelayout>

activity_nexttopic

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:android1="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".nexttopic" > <listview android1:id="@+id/list_view" android1:layout_width="match_parent" android1:layout_height="250dp" android1:layout_centerhorizontal="true" android1:layout_centervertical="true" android:background="@drawable/bg"> </listview> </relativelayout>

android image layout-inflater

No comments:

Post a Comment