Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android icon vs logo

Android icon vs logo

編輯:關於Android編程

Android 配置文件中有icon和logo兩個屬性。那這兩個屬性有什麼區別呢?

清單文件中activity的icon屬性介紹:

 

android:icon

An icon representing the activity. The icon is displayed to users when a representation of the activity is required on-screen. For example, icons for activities that initiate tasks are displayed in the launcher window. The icon is often accompaniedby a label (see the android:label attribute).

This attribute must be set as a reference to a drawable resource containing theimage definition. If it is not set, the icon specified for the application as awhole is used instead (see the element's icon attribute).

Theactivity's icon — whether set here or by the element— is also the default icon for all the activity's intent filters (see the element's icon attribute).

 

大體意思就是說icon代表了一個activity,它作為activity的界面顯示展示給用戶,比如說啟動界面上MainActivity的圖標。此外,它的屬性值必須是一個drawable類型的資源文件。如果沒有給activity定義,那麼這個activity會使用application的icon屬性。

下面是application的icon屬性介紹:

 

android:icon

An iconfor the application as whole, and the default icon for each of theapplication's components. See the individual icon attributesfor , , , ,and elements.

This attribute must be set as a reference to a drawable resource containing the image (for example@drawable/icon).There is no default icon.

同activity的icon屬性類似,但是application的icon屬性石沒有默認值的。aplication的icon屬性是用來顯示在安裝界面和安裝包縮略圖的,而不包括桌面和啟動器圖標。桌面、啟動器上顯示的圖是應用的主activity(一般名稱為MainActivity)裡icon。

logo屬性介紹:

 

android:logo

A logo for the application as whole, and the default logofor activities.

This attribute must be set as a reference to a drawableresource containing the image (for example@drawable/logo). There is no default logo.


logo不會被作為桌面圖標,僅作為activity的導航圖,而當同時設置了icon與logo屬性時(閒的),logo會完全覆蓋掉icon。

 

Using a logo instead ofan icon

 

By default, the systemuses your application icon in the action bar, as specified by the icon attribute in the or element. However, if you also specifythe logo attribute, then the action bar usesthe logo image instead of the icon.

A logo should usually bewider than the icon, but should not include unnecessary text. You shouldgenerally use a logo only when it represents your brand in a traditional format that users recognize. A good example is the YouTube app's logo—the logorepresents the expected user brand, whereas the app's icon is a modifiedversion that conforms to the square requirement for the launcher icon.


ActionBar的應用:

 

ActionBar actionBar=getActionBar();

 

使用android:logo屬性。不像方方正正的icon,logo的圖像不會有任何寬度限制

當你有Logo的時候,你可以隱藏label。

隱藏Label標簽:

actionBar.setDisplayShowTitleEnabled(false);

 

隱藏logo和icon:

actionBar.setDisplayShowHomeEnabled(false);

 

默認情況下,actionBar放在你的activity的頂部,且作為activity布局的一部分。設置成為覆蓋模式後,actionBar相當於漂浮在activity之上,不干預activity的布局。

 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved