Pregunta

Here's my code:

<PreferenceCategory
   android:summary="Fade information"
   android:title="Fade Effects"> 

   <CheckBoxPreference
     android:title="Fade In/Out"
            android:defaultValue="false"         
            android:key="fadeIn"/> 

   <CheckBoxPreference
     android:title="Heartbeat"
            android:defaultValue="false"   
            android:key="heartbeat" />  

   <CheckBoxPreference
     android:title="Pulse"
            android:defaultValue="false"               
            android:key="pulse" />  

   <CheckBoxPreference
     android:title="None"
            android:defaultValue="true"
            android:key="none" />  
</PreferenceCategory>

I'm basically trying to figure out how to make those CheckBoxes appear as they are, but having them unclickable by the user.

¿Fue útil?

Solución 2

Use android:enabled="false" from your XML, or setEnabled() in Java code.

Otros consejos

Using android:enabled="false" is incorrect as this actually completely disables a View (it also greys it out which is the main issue). What you want to do instead is:

android:clickable="false"

This simply stops the user clicking the View but doesn't officially 'disable' it. I think that's more what you are looking for.

You can use android:selectable="false" in xml if you don't wish to gray out the CheckboxPreference.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top