I am trying to display Image And Text in this format, but i am unable to do it.
Is this possible? if so, Can anybody please help me in doing this. Thanks in advance..
this is my XML for the list view row..
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/myImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/myImageViewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/myImageView"
android:layout_alignTop="@+id/myImageView"
android:layout_margin="1dp"
android:gravity="center"
android:text="Hello"
android:textColor="#000000" />
</RelativeLayout>
here is getView method:
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.alerts_row, null);
}
DbNewsItem o = items.get(position);
if (o != null) {
TextView desc = (TextView) v.findViewById(R.id.alert_details);
ImageView iv = (ImageView) v.findViewById(R.id.alert_image);
desc.setText(o.getDesc());
imageLoader.displayImage(img_url, iv, options);
}
return view;
}