2012-08-30 30 views

回答

1

windowBackground屬性是完美的。

<style name="MyTheme" parent="Theme.Sherlock"> 
    <item name="android:windowBackground">here!</item> 
</style> 
+0

THX了很多工作得很好 - 我的應用程序我更喜歡AmJay的解決方案,因爲它的操作欄保持黑色,但這只是我個人的偏好 – dorjeduck

+0

默認情況下,操作欄是透明的。如果你想要一個黑色的動作欄,你應該切換到使用純色風格。在窗口上設置活動背景比在佈局上設置要快得多。參考:http://wwwcurious-creature.org/2009/03/04/speed-up-your-android-ui/ –

+0

偉大的,thx很多提示傑克。有沒有縮放圖像的方法,就像我可以用android:scaleType =「centerCrop」縮放ImageView – dorjeduck

0

只需設置爲您的活動主佈局的背景。例如,在你的佈局文件中:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="@drawable/myImage" > 
+0

THX作品非常好 - 對不起初學者跟進問題,我如何在佈局中指定的縮放的圖像,以及如何做我「色」吧 - THX – dorjeduck

0

只需在onCreate()中寫下面的代碼行即可。

getSupportActionBar().setIcon(R.drawable.your_image);