when i add the style attribute for the my relativeLayout below it
breaks the onClick events in my activity.

---

<style name="list_item_bl" parent="text_large_bl">
        <item name="android:paddingRight">4sp</item>
        <item name="android:paddingLeft">4sp</item>
        <item name="android:background">@drawable/list_item_bl</item>
        <item name="android:focusable">false</item>
        <item name="android:focusableInTouchMode">false</item>
        <item name="android:clickable">true</item>
</style>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

        <TextView android:id="@+id/TextView01"
                          android:layout_height="wrap_content"
                          android:text="blah blah blah... blah blah"
                          android:textStyle="normal|bold"
                          android:gravity="center_vertical|center_horizontal"
                          android:layout_width="fill_parent" />

        <ListView android:id="@android:id/list"
                          android:layout_height="wrap_content"
                          android:layout_width="fill_parent" />
        <TextView
                android:id="@+id/android:empty"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/nothing" />

 </LinearLayout>

<?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:orientation="horizontal"
        android:id="@+id/list_item"
        style="?listItem" >

        <TextView
                android:id="@+id/item_entry"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="left" android:focusable="false"
android:focusableInTouchMode="false"/>
    <TextView
                android:id="@+id/category_entry"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/item_entry"
                android:gravity="right"
                android:paddingLeft="8sp" android:focusable="false"
android:focusableInTouchMode="false"/>
    <TextView
                android:id="@+id/date_completed"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:gravity="right"
                android:paddingLeft="4sp" android:focusable="false"
android:focusableInTouchMode="false"/>

</RelativeLayout>

----

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

         ....

        fillData();
        getListView().setOnCreateContextMenuListener(this);

    }

        private void fillData() {
                ArrayList<String> names = new ArrayList<String>();
                for (int i = 0; i < _options.length; i++) {
                        String item = (String) _options[i];
                        if (_selections[i]) names.add(item);
                }
                _taskCursor = _dbHelper.fetchTasksByName(names);
                startManagingCursor(_taskCursor);

                String[] from = new String[] { TaskDbAdapter.KEY_ITEM,
TaskDbAdapter.KEY_CATEGORY, TaskDbAdapter.KEY_DATE };
                int[] to = new int[] { R.id.category_entry, R.id.item_entry,
R.id.date_completed };

                ListAdapter notesAdapter = new ListAdapter(this, 
R.layout.list_item,
_taskCursor, from, to);
                //SimpleCursorAdapter notesAdapter = new 
SimpleCursorAdapter(this,
R.layout.list_item, taskCursor, from, to)
                notesAdapter.setViewBinder(new ViewBinder() {
                                public boolean setViewValue(View aView, Cursor 
aCursor, int
aColumnIndex) {
                                        if (aColumnIndex == 3) {
                                                Date createDate = new 
Date(aCursor.getLong(aColumnIndex));
                                                TextView textView = (TextView) 
aView;
                                                
textView.setText(listFormat.format(createDate));
                                                return true;
                                        }
                                        return false;
                                }
                });

                setListAdapter(notesAdapter);
        }




---

i wrote a custom ListAdapter to see that would solve my problem.  i
can catch the listOnClick this way (with a lot of extra work) but
onCreateContextMenu never seems to get invoked.

this seems really weird that applying a style would break event
handling...

-- 
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

Reply via email to