android - 小吃吧从右到左(自定义snackBar) Kotlin
问题描述
我正在构建一个使用波斯语(波斯语)语言的应用程序,当然,我需要snackBar,但问题出在:请看这张照片,我想在snackBar 的右侧设置标题
这是我的snackBar Code:
Snackbar.make(
mEditFragmentBiding.root,
resources.getText(R.string.empty_user_field_error),
Snackbar.LENGTH_LONG
)
.setAction(resources.getText(R.string.submit)) {
}
.setActionTextColor(resources.getColor(android.R.color.white))
.show()
实际上,我已经访问并检查了类似这个或这个的其他答案,但没有我想要的。
感谢任何帮助。
解决方案
这是波斯语(从右到左)语言的人需要的教程链接。
如果您不想更改某些对象(例如 TextViews)的位置,则必须在对象或布局的 Xml 中添加此行。
android:layoutDirection="ltr"
android:gravity="right"
强烈的:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layoutDirection="ltr"
android:gravity="right"
android:onClick="@{() -> viewModel.goToIncrease()}"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:gravity="center"
android:textColor="@color/black"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:gravity="center"
android:text="@string/submit_increase"
android:textColor="@color/black"
android:textSize="20sp" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="left"
android:src="@drawable/ic_baseline_add_circle_24" />
</LinearLayout>
只要看看线性布局,你就会知道如何使用(我是为 BEGINERES 说的)。
推荐阅读
- javascript - iOS 在 Powerpoint 中从 Cordova 应用程序打开 ppt/pptx 文件
- angular - HTTP_INTERCEPTORS 的 multi:true 属性是什么意思?
- javascript - Express JS 中的 POST 函数
- typescript - Intersection not merging enums for property
- vba - 用户输入编辑宏以调整 Excel 排序
- python - PyGame pygame.sprite.collide_mask 没有检测到碰撞?
- javascript - 带有scrollTop的动画div在滚动页面中丢失动画
- python - 将参数替换为语句
- json - JSON - WepAPI - 解析值时遇到意外字符
- r - Sparklyr:尝试使用外部变量作为索引访问存储在列中的向量的元素