You can override getView(View, ViewGroup) in your preference. Then send new LayoutParams to getView() . I tried it with a custom CheckBoxPreference. It works great.
import android.content.Context; import android.preference.CheckBoxPreference; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView.LayoutParams; public class CustomCheckBoxPreference extends CheckBoxPreference { public CustomCheckBoxPreference(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); } public CustomCheckBoxPreference(final Context context, final AttributeSet attrs) { super(context, attrs); } public CustomCheckBoxPreference(final Context context) { super(context); } @Override public View getView(final View convertView, final ViewGroup parent) { final View v = super.getView(convertView, parent); final int height = android.view.ViewGroup.LayoutParams.MATCH_PARENT; final int width = 300; final LayoutParams params = new LayoutParams(height, width); v.setLayoutParams(params ); return v; }
}
Just be careful to use the correct LayoutParams for the view, or you may get a class exception.
source share