Wednesday, June 16, 2010

[android-developers] Re: Help me out with my Listview custom row layout, I already tried many combinations

There are some errors I found. Have a look at this xml.

But without knowing what exactly you want, I can't really help you
with the layout. A screenshot will be helpful.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="4dip">
<ImageView android:id="@+id/icon" android:layout_width="48dip"
android:layout_height="48dip" android:src="@drawable/icon"
android:layout_marginRight="4dip" />
<ImageButton android:id="@+id/android_button"
android:layout_width="48dip" android:layout_height="48dip"
android:src="@drawable/icon" android:background="#00000000"
android:layout_toRightOf="@id/icon" android:layout_alignRight="@+id/
centerText" />
<LinearLayout android:id="@+id/centertext"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_below="@id/icon" android:layout_width="fill_parent">
<TextView android:id="@+id/titletext" android:textSize="16sp"
android:textStyle="bold" android:text="Text One"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView android:id="@+id/summarytext"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:textSize="10sp"
android:singleLine="false" android:text="Text Two" />
</LinearLayout>
</RelativeLayout>

Thanks and Regards,
Kumar Bibek
http://tech-droid.blogspot.com

On Jun 13, 7:42 pm, Shai <levys...@gmail.com> wrote:
> Hi,
> I am having trouble getting my layout to give me result I need, I
> already tried many options and it seems that I'm doing something wrong
> or completely missing something.
>
> I have a listview with a custom row layout I can't seem to working
> although it shouldn't be complex.
> I need of the list row to insist of:
>
> Icon --  title text (bigger and bold) with a short multi line text
> under the title -- ImageButton
>
> My problem in most of my tests is the icon to the right usually
> doesn't appear, I guess my center group grows and takes all the space
> of the button.
> My last failed attempt was with a Relative Layout, didn't have too
> much luck with a Linear Layout either.
>
> Here is the row XML:
>
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>      android:layout_width="fill_parent"
>      android:layout_height="wrap_content"
>      android:padding="4dip">
>     <ImageView
>         android:id="@+id/icon"
>         android:layout_width="48dip"
>         android:layout_height="48dip"
>         android:src="@drawable/icon"
>         android:layout_marginRight="4dip"
>         />
>
>   <LinearLayout
>          android:id="@+id/centertext"
>      android:layout_width="wrap_content"
>      android:layout_height="wrap_content"
>      android:layout_toRightOf="@+id/icon"
>      android:orientation="vertical"
>          >
>         <TextView
>             android:id="@+id/titletext"
>             android:textSize="16sp"
>             android:textStyle="bold"
>             android:textColor="@color/titlecolor"
>             android:layout_width="fill_parent"
>             android:layout_height="wrap_content"
>
>             />
>         <TextView
>                 android:id="@+id/summarytext"
>             android:layout_width="fill_parent"
>                 android:layout_height="fill_parent"
>             android:textSize="10sp"
>             android:textColor="@color/titlecolor"
>             android:singleLine="false"
>
>         />
>     </LinearLayout>
>
>     <ImageButton
>     android:id="@+id/android_button"
>     android:layout_width="48dip"
>     android:layout_height="48dip"
>     android:layout_toRightOf="@+id/centertext"
>     android:src="@drawable/playbutton"
>     android:background="#00000000"
>         />
>
> </RelativeLayout>
>
> Any pointers on what am I doing wrong ?  Would you suggest keeping the
> relative view or dropping it ?
>
> How can I force my vertical LinearLayout (@+id/centertext) to leave
> space for my button ? I tried both 'wrap_content' and 'fill_parent'

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment