I have a subclass of PreferenceFragment. I want each of its elements (Preferences and SwitchPreferences) to have a height of 120dp. How to do it?
Here is the related code:
public class SettingsFragment extends PreferenceFragment { public SettingsFragment() {} @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.main); } }
and
<?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <SwitchPreference android:key="app_main_switch" android:title="@string/app_name" android:defaultValue="true"/> <Preference android:title="@string/events_lowercase" android:dependency="app_main_switch"> <intent android:targetPackage="hu.ppke.itk.marma.android.bead" android:targetClass="hu.ppke.itk.marma.android.bead.EventList"/> </Preference> <Preference android:title="@string/filters_lowercase" android:dependency="app_main_switch"> <intent android:targetPackage="hu.ppke.itk.marma.android.bead" android:targetClass="hu.ppke.itk.marma.android.bead.FilterList"/> </Preference> <SwitchPreference android:dependency="app_main_switch" android:key="learn_switch" android:defaultValue="false" android:title="@string/learning"/> </PreferenceScreen>
Here's what it looks like now:

Therefore, I want all four list items to have a height of 120dp. As you can see, I'm not the one who creates the ListView, it is created internally. I tried to get it using
findViewById(android.R.id.list)
but iterating over its elements gives Preference objects that do not allow you to set the height.
source share