Try creating a custom Preference class (you may have to do it for every type of Preference you are going to use/want height to be 120DP)
public class SwitchPref extends SwitchPreference {
Context context;
public Pref(Context context) {
super(context);
this.context = context;
}
@Override
protected View onCreateView(ViewGroup parent) {
LinearLayout layout = new LinearLayout(getContext());
LinearLayout.LayoutParams params1 = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, dpToPx(120));
layout.setLayoutParams(params1);
//if this returns just the linearlayout, you will have to add your own switch
// or reference to a layout.xml resource
return super.onCreateView(layout);
}
public int dpToPx(int dp) {
int valueInDp = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources()
.getDisplayMetrics());
return valueInDp;
}
}
Then, in your preference.xml:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<!--use your custom SwitchPrefence class-->
<my.package.name.SwitchPref 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>
<my.package.name.SwitchPref android:dependency="app_main_switch"
android:key="learn_switch"
android:defaultValue="false"
android:title="@string/learning"/>
</PreferenceScreen>
Hope this helps, happy coding!