문제

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.

도움이 되었습니까?

해결책 2

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top