Fix text view padding issue in EmptyTextSettings

Set the left and right padding of text view to 24dp.

Impact pages:
Apps & notifications > Special app access > Premium SMS access
Apps & notifications > Special app access > VR helper services

Fixes: 147901392
Test: visual
Change-Id: I01aa7935462e4d16e56be71a8f1f0cbe9b8275f9
This commit is contained in:
Yanting Yang
2020-05-14 04:24:57 +08:00
parent 17ad56b3fc
commit a2d5ba3ebe
2 changed files with 7 additions and 0 deletions

View File

@@ -430,4 +430,7 @@
<!-- Output switcher panel related dimensions -->
<dimen name="output_switcher_slice_padding_top">12dp</dimen>
<!-- Text padding for EmptyTextSettings -->
<dimen name="empty_text_padding">24dp</dimen>
</resources>

View File

@@ -25,6 +25,7 @@ import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
@@ -36,6 +37,9 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
super.onViewCreated(view, savedInstanceState);
mEmpty = new TextView(getContext());
mEmpty.setGravity(Gravity.CENTER);
final int textPadding = getContext().getResources().getDimensionPixelSize(
R.dimen.empty_text_padding);
mEmpty.setPadding(textPadding, 0 /* top */, textPadding, 0 /* bottom */);
TypedValue value = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.textAppearanceMedium, value, true);
mEmpty.setTextAppearance(value.resourceId);