[英]how replace overflow and navigation drawer in action bar?
Hello guys i searched a lot but i got nothing how can i replace these two icon in my action bar ? 大家好,我进行了很多搜索,但是我什么也没得到,我该如何替换操作栏中的这两个图标? thanks a lot
非常感谢
i have already tried but result was not ok . 我已经尝试过了,但是结果还不好。
<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>
Try this 尝试这个
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);
add below in AndroidManifest.xml
like 在
AndroidManifest.xml
添加以下内容
<application android:supportsRtl="true">
your code looks like 您的代码看起来像
<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>
then 然后
add below line of in your activity's onCreate()
method 在活动的
onCreate()
方法中添加以下行
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.