@style/TranslucentAction...">

How does QuickPic make a translucent action bar?

Android KitKat has options for

    <item name="android:actionBarStyle">@style/TranslucentActionBar</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>

How do I run an application, such as QuickPic, where when I scroll through the contents it starts to scroll under the action bar?

<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container" 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="false"
tools:context="com.jhdev.red.MainActivity"
tools:ignore="MergeRootFrame" >

<GridView
    android:id="@+id/grid"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:numColumns="@integer/num_columns"
     android:clipToPadding="false"/>

</FrameLayout>
+3
source share
3 answers

Only for Android 3.0 and above

If your minSdkVersion is set to 11 or higher, your custom theme should use the Theme.Holo theme (or one of its descendants) as the parent theme. For instance:

<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@android:style/Theme.Holo">
        <item name="android:windowActionBarOverlay">true</item>
    </style>
</resources>

For Android 2.1 and higher

If your application uses the support library for compatibility on devices with versions lower than Android 3.0, your custom theme should use Theme.AppCompat (or one of its descendants) as the parent theme. For instance:

<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@android:style/Theme.AppCompat">
        <item name="android:windowActionBarOverlay">true</item>

        <!-- Support library compatibility -->
        <item name="windowActionBarOverlay">true</item>
    </style>
</resources>

, , . , , (), , actionBarSize. :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?android:attr/actionBarSize">
    ...
</RelativeLayout>

, android:. :

<!-- Support library compatibility -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="?attr/actionBarSize">
    ...
</RelativeLayout>

? attr/actionBarSize , Android 3.0 .

.

+2

:

android:clipChildren="false" 

FrameLayout

+1

:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    ...

    <item name="android:actionBarStyle">@style/TransparentActionBar</item>
    <item name="android:windowActionBarOverlay">true</item>
    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/TransparentActionBar</item>
    <item name="windowActionBarOverlay">true</item>
</style>

<!--Default alpha for translucent navigation/status bar is 40% of black color-->
<color name="transparent_color">#6000</color>

<style name="TransparentActionBar" parent="Widget.AppCompat.ActionBar.Solid">
    <item name="android:background">@color/transparent_color</item>
    <!--Compatibility-->
    <item name="background">@color/transparent_color</item>
</style>
0

All Articles