Hi! I'm having troubles with the ListViews. It's impossible to me make
them work correctly. Each row contains two buttons, a checkbox, an
ImageView and a TextView. I want a row expands (show the buttons and
the checkbutton) when I make a long click and perform an action with
normal clicks. I tried to use the setItemsCanFocus(true) method but
the row ignores the clicks. Only if I long press the TextView I get
the row expands, but then it's impossible to make the row contracts
long clicking another time on the TextView. Depends the textview
configuration (if I use the deprecated singleLine="true" or lines="1"
properties instead of android:inputType="text") the behaviour changes,
the row reacts fine (the row expands or contracts) to all the clicks
but only on the TextView. I want that if the user clicks on the row
itself, it expands but it seems that only the TextView pass the clicks
events to the row.
Apart from that, I'm not able to implement correctly the
alignWithParentIfMissing property following the "Android Layout Tricks
#1" page of Romain Guy. I want that if the buttons and the checkbox
are hidden (visibility="gone"), the TextView take up all the space and
it's centered on the layout. When those elements get visible, oddly
the TextView desappears and if they are not visible, the TextView
doesn't appears at the center of the layout.
Here is all the XML code about the listview and the items (if you need
the adapter's code or something else, tell me, but I think the problem
is in the XML):
This is the XML code of the ListView:
<ListView android:id="@+id/login_list_view"
android:layout_below="@id/login_text"
android:layout_above="@id/login_another_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3dip"
android:divider="#EDEFF4"
android:cacheColorHint="#EDEFF4"
android:dividerHeight="3dip"
android:scrollbars="none"/>
And this is XML code of the list items:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dip"
android:paddingBottom="0dip"
android:background="@drawable/login_list_item_background">
<ImageView
android:id="@+id/user_image"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_alignParentTop="true"
android:layout_marginRight="6dip"
android:src="@drawable/icon"
android:scaleType="fitXY"/>
<CheckBox
android:id="@+id/login_list_item_access_always"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/user_image"
android:layout_alignParentRight="true"
android:text="@string/login_list_item_access_always"
android:textColor="#83021837"
android:textSize="15sp"
android:paddingLeft="45dip"
android:visibility="gone"/>
<TextView
android:id="@+id/user_name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/login_list_item_access_always"
android:layout_toRightOf="@id/user_image"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true"
android:inputType="text"
android:textColor="#FF6D84B4"
android:textSize="18sp"
android:gravity="center_vertical"/>
<Button
android:id="@+id/login_list_item_login"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="@id/login_list_item_access_always"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="@string/login_list_item_login"
android:textColor="#FF000000"
android:visibility="gone"/>
<Button
android:id="@+id/login_list_item_delete"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="@id/login_list_item_access_always"
android:layout_toLeftOf="@id/login_list_item_login"
android:layout_alignParentBottom="true"
android:text="@string/login_list_item_delete"
android:textColor="#FF000000"
android:visibility="gone"/>
</RelativeLayout>
Thank you.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en