如何在android中同时获得导航和backbutton ---------------- |
尝试使用自定义如何在android中同时获得导航和backbutton ---------------- |,android,Android,尝试使用自定义工具栏 ---------------- | <- = | ---------------- <- back = navigation toggle button 您的图像未显示。请共享您的图像code@NileshRathod更新您的图像again@MikeM. 请检查图片,谢谢,但是切换动画呢 <android.support.v7.widget.Toolbar android:id="@+id/ar_toolbar"
工具栏
----------------
| <- = |
----------------
<- back
= navigation toggle button
您的图像未显示。请共享您的图像code@NileshRathod更新您的图像again@MikeM. 请检查图片,谢谢,但是切换动画呢
<android.support.v7.widget.Toolbar
android:id="@+id/ar_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round" />
<ImageView
android:id="@+id/img_drawericon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
Toolbar toolbar;
toolbar = (Toolbar) findViewById(R.id.ar_toolbar);
ImageView backIMG =(ImageView) toolbar.findViewById(R.id.img_back);
ImageView drawerIMG =(ImageView) toolbar.findViewById(R.id.img_drawericon);
setSupportActionBar(toolbar);
backIMG.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(ReferralsActivity.this, "Back arrow clicked", Toast.LENGTH_SHORT).show();
onBackPressed();
}
});
drawerIMG.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(ReferralsActivity.this, "Drawer icon clicked", Toast.LENGTH_SHORT).show();
}
});