Only select one checkbox of splash preference checkedboxs

前端 未结 3 2042
北恋
北恋 2021-01-18 23:14

I have app starting depend on user preferance with three different checkedbox :

1- start app without splash and music .

2- start app with splash only .

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-19 00:07

    I implemented Radio buttons inside preference activity that looks like check boxes as follows..

    enter image description here

    Only one can be selected at a time. I done this using 2 more xml files

    enter image description here

    One inside drawable(check_dyn.xml) and another inside layout(radiochecks.xml) .

    check_dyn.xml

    
       
        
        
    
    

    radiochecks.xml

    
        
    
            
    
            
    
            
        
    
    
    

    Now, inside the preference,(here prefs.xml), add a preference and set its layout property. ie,

    
    

    Note: I don't prefer a practice like this, since it is hard to get the individual values.

    I prefer ->

    From settings enter image description here

提交回复
热议问题