简体   繁体   English

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

[英]Background App Image and partially transparent custom action bar

I'm new in Android. 我是Android的新手。 I have two questions: 我有两个问题:

I have an application with a first Login view and some others view. 我有一个应用程序,第一个登录视图和其他一些视图。

I would like to set an image as background for all views except the login view. 我想将图像设置为除登录视图之外的所有视图的背景。 Is there a way to set this background view in some way or do I need to have an ImageView into every layouts? 有没有办法以某种方式设置此背景视图或我是否需要在每个布局中都有ImageView?

Is it possible to have the action bar partially transparent? 操作栏是否可以部分透明? I would like to overlap the action bar on the background image into every view. 我想将背景图像上的操作栏重叠到每个视图中。

Is possible to have an ActionBar with customized height? 可以有一个自定义高度的ActionBar吗? I would like to have an action bar thinner but not completely on top (I would not want it to start from y = 0) Is this possible? 我想让一个动作条更薄但不完全在顶部(我不希望它从y = 0开始)这可能吗?

For background image, you can set your default app theme with a background. 对于背景图像,您可以使用背景设置默认应用主题。 /res/values/styles.xml /res/values/styles.xml

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

You can set your default theme for the whole application in AndroidManifest file with application tag. 您可以在AndroidManifest文件中使用应用程序标记为整个应用程序设置默认主题。

Then you create another style for login activity and set the theme from AndroidManifest > activity tag for login. 然后为登录活动创建另一种样式,并从AndroidManifest> activity标签设置主题以进行登录。
http://developer.android.com/guide/topics/ui/themes.html http://developer.android.com/guide/topics/ui/themes.html

For ActionBar I'm not sure you can change the height, you may need to use a custom action bar implementation for that. 对于ActionBar,我不确定您是否可以更改高度,您可能需要使用自定义操作栏实现。

You may want to check this resources for custom action bar implementations, 您可能需要检查此资源以获取自定义操作栏实现,
Custom actionbar layout with overflow menu 具有溢出菜单的自定义操作栏布局
Android ActionBar custom layout styling Android ActionBar自定义布局样式
How can I implement custom Action Bar with custom buttons in Android? 如何在Android中使用自定义按钮实现自定义操作栏?

You can change the style of ActionBar, you can give a background color with alpha and use windowActionBarOverlay property for the Action Bar style. 您可以更改ActionBar的样式,您可以使用alpha提供背景颜色,并使用windowActionBarOverlay属性作为Action Bar样式。
https://developer.android.com/training/basics/actionbar/overlaying.html https://developer.android.com/training/basics/actionbar/overlaying.html
Transparent Actionbar: custom tabcolor 透明动作栏:自定义tabcolor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM