아이콘이 애플리케이션에 표시되지 않습니다. 어떻게해야합니까?Android : 애플리케이션에 아이콘 표시
이 방법을 추가하려고했지만 작동하지 않았습니다.
이 방법을 사용하면 메뉴의 응용 프로그램 아이콘 만 변경됩니다.
아이콘이 애플리케이션에 표시되지 않습니다. 어떻게해야합니까?Android : 애플리케이션에 아이콘 표시
이 방법을 추가하려고했지만 작동하지 않았습니다.
이 방법을 사용하면 메뉴의 응용 프로그램 아이콘 만 변경됩니다.
1 번 변경 바는 다음
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
3 번 mainfest-> 아이콘 변경
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
이것은 부분적으로 도움이되었습니다. 이제 다른 레이아웃으로 이동할 때 홈 버튼이 생깁니다. 그러나 여전히 아이콘을 표시하지 않습니다. @Cgx –
아래 toolbar_actionbar.xml 만들기 도구 모음 :
<?xml version="1.0" encoding="utf-8"?>
<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="56dp"
android:background="@color/colorPrimary"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="@+id/imgbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@android:color/transparent"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_toEndOf="@+id/btn_back"
android:layout_toRightOf="@+id/btn_back"
android:text="Weather"
android:textColor="@android:color/white"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
부모 테마의 행 아래에 쓰기, 당신의 스타일에
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"></include>
:
<item name="android:windowActionBar">false</item>
<item name="windowNoTitle">true</item>
그리고 당신의 활동에 선 아래로 추가 6,
라인 아래 사용하여 기본 레이아웃 파일에 위의 레이아웃을 추가 :
Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ImageButton imgbtn=(ImageButton)toolbar.findViewById(R.id.imgBtn);
는 다른 새로운 아이콘 시도하고 당신은 당신의 액션 바 또는 도구 모음 사용자 정의 레이아웃을 사용할 필요가 –
프로젝트를 다시 빌드합니다. – Drv
http://stackoverflow.com/questions/5350624/set-icon-for-android-application/5350771#5350771 –