Android - Listview Items Inside App Widget Not Selectable
I have built a collection app widget for my Android app. The widget consists of a toolbar and then a ListView of tasks (it's a todo-list). The problem is the ListView doesn't show
Solution 1:
To show a divider in your ListView
use
android:dividerHeight="4px"android:descendantFocusability="blocksDescendants"
And to make items clickable in your ListView
android:clickable="true"
So your final ListView
may look like this
<ListView
android:id="@+id/tasksLView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#FFCC00"
android:dividerHeight="4px"
android:clickable="true"
android:descendantFocusability="blocksDescendants"/>
You might consider adding clickable
attribute in your tasks_widget_list_item
too.
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"android:paddingStart="16dp"android:paddingEnd="16dp"android:clickable="true"android:id="@+id/task_list_item_main"><!-- .... Other views --></LinearLayout>
Post a Comment for "Android - Listview Items Inside App Widget Not Selectable"