Andy,
Say in the MarkupDemo I wanted to add two buttons to a MasterItem Row
- I could make the master_template.xml file look like
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="
http://schemas.android.com/apk/res/
android"
xmlns:binding="
http://www.gueei.com/android-binding/"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:id="@android:id/text1"
android:layout_width="wrap_content"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingLeft="?android:attr/
expandableListPreferredItemPaddingLeft"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
binding:text="."
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="boo"
android:state_focused="true"
binding:onClick="OpenCloseCmd"
/>
<</LinearLayout>
This would place a button on each row of a MasterItem - which I would
like to be able to click and activate a command. The trouble is when I
add the button it takes focus and the expander no longer works.
I found a possible solution to this known problem on the web:
http://stackoverflow.com/questions/9880950/button-in-expandable-listview-android
But this solution is without androidbinding:-
The button should be no-focuseable. In your
listView.setOnItemClickListener (not in xml layout!!) :
Button button = (Buttom) view.findViewById(R.id.yourButton); //where
button is the button on listView, and view is the view of your item on
list
button.setFocusable(false); /// THIS IS THE SOLUTION
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) { //button
functionalty ... } });
}
Regds
> > this is because focus moves to the button.- Hide quoted text -
>
> - Show quoted text -