I want to hide the edit text and button field initially in list view and show that edit text and button for a particular raw in list view when that raw is clicked.So I tried
In my Case setOnItemClickListener works fine in Android Versions Upto 5.1.1
But Having On Android 6.0.1. At last I found the solution
Try this
Remove these Lines from Your XML Layout
android:orientation="vertical"
tools:context=".ManageRequest"
android:contextClickable="true"
Works for Me in Android Version 6.0.1 Hope Your Problems Solved ..!!! Happy Coding :)
Add the following attributes to your button
android:focusable="false"
android:focusableInTouchMode="false"
ListView setOnItemClickListener not working by adding button
Is your edittext taking focus on click of list item? If so remove the focus on edittext also.
// try this
public class MainPortal extends Activity {
private List<Employee> employees = new ArrayList<Employee>();
EditText et;
ListView list;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_portal);
populateEmployeeList();
//populsteListView();
list = (ListView) findViewById(R.id.employeeListView);
ArrayAdapter<Employee> adapter = new MylistAdapter();
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//I ADDED ON CLICK IMPLEMENTATION HERE, BUT THIS IS NOT WORKING
Toast.makeText(getApplicationContext(), "CLICKED", Toast.LENGTH_SHORT).show();
}
});
}
}
Here your edittext inside the listview is having all the focus, so this listview onClick is not working. Remove the focus from the editext box and it will start working