Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

android - how to use material design features in api lower than 21 in eclipse?

there are many questions regarding this but not even single helped me.

So please tell me how to enable material design features in eclipse.

i have also imported appcompat_v7 library in project but it does not create a folder with name values_v21 which helps in using those feature i think.

So please help me out in this

here is my styles.xml file

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/AppTheme_ActionBar</item>
        <item name="android:actionBarSize">@dimen/action_bar_height</item>
        <item name="android:windowContentOverlay">@drawable/actionbar_shadow</item>
        <item name="android:homeAsUpIndicator">@drawable/ic_ab_up_compat</item>
       <item name="android:actionBarTabTextStyle">@style/tabtextcolor</item>
        <item name="android:actionOverflowButtonStyle">@style/AppTheme_ActionBar_Overflow</item>
    </style>

    <style name="AppTheme_ActionBar" parent="android:Widget.Holo.ActionBar.Solid">
        <item name="android:background">@color/apptheme_primary</item>
         <item name="android:actionBarTabTextStyle">@style/tabtextcolor</item>
        <item name="android:icon">@drawable/actionbar_icon_placeholder_compat</item>
        <item name="android:titleTextStyle">@style/AppTheme_ActionBar_Title</item>
    </style>

    <style name="AppTheme_ActionBar_Title" parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textSize">20sp</item>
    </style>

    <style name="AppTheme_ActionBar_Overflow" parent="android:Widget.ActionButton.Overflow">
        <item name="android:src">@drawable/ic_ab_overflow_compat</item>

    </style>


    <style name="tabtextcolor" parent="@android:style/Widget.Holo.Light.ActionBar.TabText">
    <item name="android:textColor">@android:color/white</item>
</style>
</resources>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are some points you should check:

  • Import into eclipse, last version of android-support-v7-appcompat project. You should update via SDK Manager, and import project from {your_path_to_android_sdk}/extras/android/support/v7/appcompat
  • Add this project as library dependency to your project
  • In styles.xml use Theme.AppCompat.Light or Theme.AppCompat:

    style name="AppTheme" parent="@style/Theme.AppCompat.Light"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...