[英]Can we programatically change android:icon associated with activity tag in the manifest?
[英]Android change activity icon set in Manifest
這是我的清單:
<activity android:name=".plug.imp.NewActivity"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SYNC" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter android:icon="@drawable/label_icon">
<action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
在這里,我設置了可繪制圖標。
是否可以在活動本身中設置它並將其從清單中刪除?
謝謝。
嘗試類似:
protected void onCreate(Bundle savedInstanceState) {
.....
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
//setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
....
}
window_title.xml
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/header"
android:src="@drawable/ico_title"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
</LinearLayout>
這是活動標題的圖標,而不是應用程序圖標。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.