android - 操作栏后退箭头方向

标签 android android-actionbar material-design

在我的应用程序中,我开始设置 UI 以满足 Material Design 使用工具栏的要求。

我想在操作栏上添加后退箭头。看起来不错,但不知何故,当我将电话位置更改为希伯来语(一种 rtl 语言)时,箭头改变了它的方向,而不是指向“外”,它现在指向“内”。 请引用图片以查看箭头在希伯来语和英语中的外观。 有没有办法控制箭头方向(当然我希望它总是指向“out”)?

我尝试添加 android:layoutDirection="ltr"和 android:textDirection="ltr"但它没有帮助。

感谢谁能回答这个问题。

enter image description here

这是工具栏布局的代码:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/primaryColor"
app:theme="@style/MyCustomToolBarTheme"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"
android:textDirection="ltr"
android:layoutDirection="ltr">

最佳答案

终于改箭头方向成功了。

嗯,其实我是跟着这个post : 首先,我找到了一些操作栏图标,并在项目中放置了一个可绘制的后退图标。 然后我使用这段代码以编程方式设置箭头:

        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_action_back);

关于android - 操作栏后退箭头方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30957546/

相关文章:

android - 强制折叠 ActionBar 中的选项卡

android - 如何在 Android 的标题栏中隐藏应用程序名称?

android - 如何创建一个完全透明的导航栏?

java - if (text.equals ("") 崩溃

android - 我想使用微调器/下拉列表在 webview 上打开网站

java - 如何从扫描网络获取 WIFI 信号强度百分比?

java - 如果 get volley 请求为 true,则需要从 cardview 中的可绘制对象更新图像(200 ok)

android - Actionbar 颜色在 android 中没有改变(Lollipop)

android - 如何在 TextInputLayout 中显示错误时禁用 float

html - 尝试使用 Materialize 框架嵌入 Leaflet 的 map