我正在使用操作欄sherlock,它工作得很好。我唯一的問題是如何設置活動使用的區域的背景圖像。我最終所做的就是設置操作欄本身的背景圖像。actionbar sherlock - 如何在主題中爲活動區域設置背景圖像
任何建議高度讚賞
馬丁
我正在使用操作欄sherlock,它工作得很好。我唯一的問題是如何設置活動使用的區域的背景圖像。我最終所做的就是設置操作欄本身的背景圖像。actionbar sherlock - 如何在主題中爲活動區域設置背景圖像
任何建議高度讚賞
馬丁
該windowBackground
屬性是完美的。
<style name="MyTheme" parent="Theme.Sherlock">
<item name="android:windowBackground">here!</item>
</style>
只需設置爲您的活動主佈局的背景。例如,在你的佈局文件中:
<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" >
THX作品非常好 - 對不起初學者跟進問題,我如何在佈局中指定的縮放的圖像,以及如何做我「色」吧 - THX – dorjeduck
只需在onCreate()中寫下面的代碼行即可。
getSupportActionBar().setIcon(R.drawable.your_image);
THX了很多工作得很好 - 我的應用程序我更喜歡AmJay的解決方案,因爲它的操作欄保持黑色,但這只是我個人的偏好 – dorjeduck
默認情況下,操作欄是透明的。如果你想要一個黑色的動作欄,你應該切換到使用純色風格。在窗口上設置活動背景比在佈局上設置要快得多。參考:http://wwwcurious-creature.org/2009/03/04/speed-up-your-android-ui/ –
偉大的,thx很多提示傑克。有沒有縮放圖像的方法,就像我可以用android:scaleType =「centerCrop」縮放ImageView – dorjeduck