requestWindowFeature(Window.FEATURE_LEFT_ICON);
requestWindowFeature(Window.FEATURE_RIGHT_ICON);
再調用 setFeatureDrawableResource() 方法來設定它.
實例:
package com.AndroidTitleIcon;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
public class AndroidTitleIconActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_LEFT_ICON);
requestWindowFeature(Window.FEATURE_RIGHT_ICON);
setContentView(R.layout.main);
getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.icon);
getWindow().setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON,R.drawable.icon);
}
}
無法run>"<
回覆刪除