I created a preference entry inside preference screen, which looks like this:
<PreferenceScreen>
<Preference
android:title="title"
android:key="key"
android:widgetLayout="@layout/someview"/>
</PreferenceScreen>
Here I set a widgetlayout
resource, which should be shown to the right of the preference item (like a checkbox for a checkbox preference). I can also set this resource in code of my PreferenceActivity.onCreate()
like this:
Preference myPreference = findPreference("key");
myPreference.setWidgetLayoutResource(R.layout.someview);
Both approaches work fine, so I can see my resource to the right of the preference item. However, I cannot access this resource (someview) to alter its properties on runtime.
Neither manually setting resource id, inflating it from resource or findViewById
seem to work - I have invalid resource/resource id not found exceptions. Seems like preference activity inflates the resource sometime later.
Has anybody run into the same problem? Any ideas about how to alter widgetlayout
resource's properties on runtime?
Here is a similar question, but it was not answered