简体   繁体   中英

Background App Image and partially transparent custom action bar

I'm new in 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?

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? 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?

For background image, you can set your default app theme with a background. /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.

Then you create another style for login activity and set the theme from AndroidManifest > activity tag for login.
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.

You may want to check this resources for custom action bar implementations,
Custom actionbar layout with overflow menu
Android ActionBar custom layout styling
How can I implement custom Action Bar with custom buttons in 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.
https://developer.android.com/training/basics/actionbar/overlaying.html
Transparent Actionbar: custom tabcolor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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