背景App图像和部分透明的自定义操作栏

时间:2015-02-26 23:26:14

标签: android android-activity android-actionbar imageview android-styles

我是Android的新手。 我有两个问题:

我有一个带有第一个登录视图和其他视图的应用程序。

我想将图像设置为除登录视图之外的所有视图的背景。有没有办法以某种方式设置此背景视图,还是需要在每个布局中都有ImageView?

是否可以让操作栏部分透明?我想将背景图像上的操作栏重叠到每个视图中。

可以使用自定义高度的ActionBar吗?我希望操作栏更薄但不完全在顶部(我不希望它从y = 0开始)这可能吗?

1 个答案:

答案 0 :(得分:0)

对于背景图片,您可以使用背景设置默认应用主题。 /res/values/styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:windowBackground">@drawable/bg_orange</item>
</style>

您可以在AndroidManifest文件中使用应用程序标记设置整个应用程序的默认主题。

然后为登录活动创建另一种样式,并从AndroidManifest&gt;设置主题。登录活动标签 http://developer.android.com/guide/topics/ui/themes.html

对于ActionBar,我不确定您是否可以更改高度,您可能需要使用自定义操作栏实现。

您可能想要检查此资源以获取自定义操作栏实施,
Custom actionbar layout with overflow menu
Android ActionBar custom layout styling
How can I implement custom Action Bar with custom buttons in Android?

您可以更改ActionBar的样式,您可以使用alpha提供背景颜色,并使用windowActionBarOverlay属性作为Action Bar样式。
https://developer.android.com/training/basics/actionbar/overlaying.html
Transparent Actionbar: custom tabcolor

相关问题