ListView with CheckBox Together But Independent

0

All this is simply a ListView with a Checkbox What I want to achieve is that by pressing the first element of the list in this case is 'English' do not press the checkbox and when ONLY press the Checkbox check the box

public class MainActivity extends AppCompatActivity {

 //Arraylist para guardar los elementos selecionados
 ArrayList<String> selectedItems = new ArrayList<>();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ListView chl = (ListView)findViewById(R.id.checkable_list);
    chl.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    String[] items = {"English","French","Chinese","Khmer"};
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,R.layout.rowlayout,R.id.txt_lan,items);
    chl.setAdapter(adapter);

    //Al presionar un item
    chl.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {


        }
    });
}


}
    
asked by Diego 29.04.2018 в 21:17
source

1 answer

0

Solution, create a Custom ListView which may modify the design to your liking and add all kinds of buttons, images and modify the text you want

    
answered by 15.05.2018 / 02:08
source