有人知道 Google 表格上的文本对齐按钮是什么样的吗?
单击该按钮会打开一个弹出窗口,其中包含 4 个图标以对齐文本
谢谢
图片
有人知道 Google 表格上的文本对齐按钮是什么样的吗?
单击该按钮会打开一个弹出窗口,其中包含 4 个图标以对齐文本
谢谢
图片
您的问题不够清楚,但是如果我理解正确并且您想要一个带有 4 个按钮的弹出窗口,您可以创建一个自定义对话框,该对话框根据您的需要弹出带有 4 个或更少图标的弹出窗口。
这是方法:
首先创建custom_dialog.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:background="@drawable/custom_dialog_border"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@color/colorPrimary"
android:gravity="center"
android:padding="@dimen/dimen5dp"
android:text="@string/choose_language"
android:textColor="@color/white"
android:textSize="20sp" />
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="@dimen/dimen1dp"
android:layout_marginBottom="@dimen/dimen10dp"
android:background="@color/gray" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginBottom="5dp">
<Button
android:id="@+id/txtEnglish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|start"
android:layout_margin="5dp"
android:background="@color/white"
android:padding="@dimen/dimen5dp"
android:text="@string/english"
android:textAllCaps="false"
android:enabled="false"
android:textColor="@color/colorPrimary" />
<Button
android:id="@+id/txtArabic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_margin="5dp"
android:padding="5dp"
android:text="@string/arabic"
android:background="@color/white"
android:textAllCaps="false"
android:textColor="@color/colorPrimary" />
</FrameLayout>
</LinearLayout>
然后在 java 文件中使用您的自定义布局
private void showCustomAlertDialog() {
final Dialog dialog = new Dialog(AccountActivity.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.custom_dialog);
Button english = dialog.findViewById(R.id.txtEnglish);
Button arabic = dialog.findViewById(R.id.txtArabic);
english.setOnClickListener(v -> {
// do something
dialog.cancel();
});
arabic.setOnClickListener(v -> {
// do something
dialog.cancel();
});
dialog.show();
}
最后在任何你想要的地方调用你的自定义对话框(在你的按钮或菜单项或其他东西内)
showCustomAlertDialog();