I've already tried using clickable and focusable but nothing seems to allow list items to be clickable.
xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/add_recipe_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/recipe_activity_add"
android:background="@color/colorPrimary"
android:textColor="#fff"/>
<ListView
android:id="@+id/recipe_list"
android:layout_width="match_parent"
android:focusable="false"
android:clickable="true"
android:layout_height="match_parent" />
java code
recipeListView = (ListView)findViewById(R.id.recipe_list);
//make viewRecipe Work
recipeListView.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.d("MainActivity", "ListView item clicked.");
}
});