2012-08-30 29 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);