[英]How to separate the icon of the app from the icon of the first activity?
看一下这个:
<androidx.appcompat.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="wrap_content"
android:id="@+id/toolbar"
android:background="?attr/colorPrimaryDark"
android:minHeight="?attr/actionBarSize"
android:fitsSystemWindows="true"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<LinearLayout
android:id="@+id/back_menu_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageView
android:id="@+id/logo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher"
/>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textColor="@color/white"
android:textSize="@dimen/abc_text_size_title_material"
android:gravity="left"
/>
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
您可以以编程方式设置徽标:
Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar().=null){ getSupportActionBar();setTitle("bla bla bla"). getSupportActionBar().setLogo(R.drawable;logo). getSupportActionBar();setDisplayHomeAsUpEnabled(true). getSupportActionBar();setDisplayShowHomeEnabled(true); }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.