public final class GrantPermissionsViewHandlerImpl implements GrantPermissionsViewHandler, OnClickListener { private static final String ARG_GROUP_NAME = "ARG_GROUP_NAME"; private final Context mContext; private ResultListener mResultListener; private String mGroupName; private LinearLayout mRootView; private TextView mMessageView; private ImageView mIconView; private TextView mCurrentGroupView; private Button mAllowButton; private Button mSoftDenyButton; private Button mHardDenyButton; public GrantPermissionsViewHandlerImpl(Context context) { mContext = context; } @Override public GrantPermissionsViewHandlerImpl setResultListener(ResultListener listener) { mResultListener = listener; return this; } @Override public View createView() { mRootView = (LinearLayout) LayoutInflater.from(mContext) .inflate(R.layout.grant_permissions, null); mMessageView = (TextView) mRootView.findViewById(R.id.permission_message); mIconView = (ImageView) mRootView.findViewById(R.id.permission_icon); mCurrentGroupView = (TextView) mRootView.findViewById(R.id.current_page_text); mAllowButton = (Button) mRootView.findViewById(R.id.permission_allow_button); mSoftDenyButton = (Button) mRootView.findViewById(R.id.permission_deny_button); mHardDenyButton = (Button) mRootView.findViewById( R.id.permission_deny_dont_ask_again_button); mAllowButton.setOnClickListener(this); mSoftDenyButton.setOnClickListener(this); mHardDenyButton.setOnClickListener(this); return mRootView; }设置mRootView的字体大小
时间: 2024-02-27 08:52:12 浏览: 96
要设置 `mRootView` 中的字体大小,您需要分别获取到 `mMessageView`、`mCurrentGroupView`、`mAllowButton`、`mSoftDenyButton`、`mHardDenyButton` 这些控件,并调用它们的 `setTextSize()` 方法来设置字体大小。
以下是一个示例代码,将 `mMessageView`、`mCurrentGroupView`、`mAllowButton`、`mSoftDenyButton`、`mHardDenyButton` 这些控件的字体大小都设置为20sp:
```
mMessageView.setTextSize(20);
mCurrentGroupView.setTextSize(20);
mAllowButton.setTextSize(20);
mSoftDenyButton.setTextSize(20);
mHardDenyButton.setTextSize(20);
```
您可以根据需要调整字体大小的值。
相关问题
public final class GrantPermissionsViewHandlerImpl implements GrantPermissionsViewHandler, OnClickListener { private static final String ARG_GROUP_NAME = "ARG_GROUP_NAME"; private final Context mContext; private ResultListener mResultListener; private String mGroupName; private LinearLayout mRootView; private TextView mMessageView; private ImageView mIconView; private TextView mCurrentGroupView; private Button mAllowButton; private Button mSoftDenyButton; private Button mHardDenyButton; public GrantPermissionsViewHandlerImpl(Context context) { mContext = context; } @Override public GrantPermissionsViewHandlerImpl setResultListener(ResultListener listener) { mResultListener = listener; return this; } @Override public View createView() { mRootView = (LinearLayout) LayoutInflater.from(mContext) .inflate(R.layout.grant_permissions, null); mMessageView = (TextView) mRootView.findViewById(R.id.permission_message); mIconView = (ImageView) mRootView.findViewById(R.id.permission_icon); mCurrentGroupView = (TextView) mRootView.findViewById(R.id.current_page_text); mAllowButton = (Button) mRootView.findViewById(R.id.permission_allow_button); mSoftDenyButton = (Button) mRootView.findViewById(R.id.permission_deny_button); mHardDenyButton = (Button) mRootView.findViewById( R.id.permission_deny_dont_ask_again_button); mAllowButton.setOnClickListener(this); mSoftDenyButton.setOnClickListener(this); mHardDenyButton.setOnClickListener(this); return mRootView; }
这是一个 Android 应用程序中的类 GrantPermissionsViewHandlerImpl,实现了 GrantPermissionsViewHandler 接口和 OnClickListener 接口。主要功能是创建一个视图,用于请求用户授予应用程序权限的操作。视图包括一个消息文本、一个图标、当前组的文本、三个按钮(允许、软拒绝、硬拒绝)。在用户点击任意一个按钮时,都会触发 OnClickListener 中的 onClick 方法,根据不同的按钮执行不同的操作。例如,点击允许按钮会请求用户授权,点击软拒绝按钮会提示用户再次考虑授权,而点击硬拒绝按钮会提示用户不再询问该权限。
阅读全文