ActionBar in Android Maven Project using Android Support Library v7

后端 未结 1 439
长情又很酷
长情又很酷 2021-01-07 11:23

I have a Android Maven project and am having difficulties to maintain compatibility using ActionBar.

Before I was using ActionBarSherlock, but I sa

相关标签:
1条回答
  • 2021-01-07 12:01

    Implement ActionBar in 2.2 device and other Functionlity like ViewPager,Framgmet Tag in 2.2 then there is two way using sherlockActionbar and AppCompat

    Sherlock is and third party library while AppCompat is Android library.
    step to use AppCompact in project

    just update android skd-> extra-> Android support library
    Then goto you sdk in your system-> Androidsdk\extras\android\support\v7 find appcompat source code. Import this appcompact in you eclipse.
    Create you project and select appcompact library from property->android-> Library.
    open you manifeast file and change theme **android:theme="@style/Theme.AppCompat.Light**" Then extend your activity with ActionBarActivity if you cannot found it then pls manualy import `

     import android.support.v7.app.ActionBar;
     import android.support.v7.app.ActionBar.Tab;
     import android.support.v7.app.ActionBarActivity;`
    

    Then Add below code to activity

    final ActionBar actionBar = getSupportActionBar();
    actionBar.setHomeButtonEnabled(false);
    
    0 讨论(0)
提交回复
热议问题