Java 如何更换操作栏中的溢出和导航抽屉?
大家好,我搜索了很多,但我什么也没找到,我怎么能替换这两个呢 我的动作栏中的图标?非常感谢 我已经试过了,但结果不好Java 如何更换操作栏中的溢出和导航抽屉?,java,android,user-interface,layout,Java,Android,User Interface,Layout,大家好,我搜索了很多,但我什么也没找到,我怎么能替换这两个呢 我的动作栏中的图标?非常感谢 我已经试过了,但结果不好 <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravit
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end" // here i tried change the gravity but didnt work
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
试试这个
Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.your_icon);
Drawable drawable = context.getDrawable(getApplicationContext(),R.drawable.your_overflowicon);
toolbar.setOverflowIcon(drawable);
在下面的AndroidManifest.xml
like中添加
<application android:supportsRtl="true">
您只想替换图标,还是想从左到右更改抽屉,从右到左更改溢出菜单?要从左到右更改抽屉,从右到左更改溢出菜单您是否尝试过此操作?否,但我会感谢您,很高兴能帮助您:)
<application
android:name=".app.AppController"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" //here change
android:theme="@style/AppTheme">
<activity android:name=".LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);