简体   繁体   中英

Library or documentation of AppCompat Parent style in android

I'm so confused designing my actionbar in android. I'm using AppCompat theme, if anyone out there who knows a better documentation of the AppCompat Theme can you please share it? API Level 19

Found one: http://android-developers.blogspot.com/2014/10/appcompat-v21-material-design-for-pre.html

App Compat support lib , don't worry about parent theme, its automatically set theme as per API level check answer if you have device with API 19 then its set that theme which is available in API-19

for Action Bar(which is deprecated by ToolBar in API 21). but if you still want to use this then extends your Activity class to AppCompatActivity

public class myDemoListActivity extends AppCompatActivity

in onCreate() use actionbar like:

final ActionBar actionBar = getSupportActionBar();

you have to use theme like

<style name="AppTheme.Bash" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

Toolbar

extends your Activity class to AppCompatActivity

public class myDemoListActivity extends AppCompatActivity

you have to use toolbar in your layout file like

<android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        </android.support.v7.widget.Toolbar>

in onCreate()

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

you have to use theme like

<style name="AppTheme.Bash" parent="Theme.AppCompat.Light.DarkActionBar">
            <item name="colorPrimary">@color/colorPrimary</item>
            <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
            <item name="colorAccent">@color/colorAccent</item>
            <item name="windowActionBar">false</item>
            <item name="windowNoTitle">true</item>
        </style>

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