How to import ActionBarSherlock in android SDK version 23 -
i trying implement sherlock actionbar in android studios, new android studios not understand need put build.gradle file dependencies section in android in order imported.
i using lastest version of andriod studos sdk version 23. please help.
someone has advised me no longer available in andriod studios how can below then.
so how can then. public class menuactivity extends sherlockactivity implements
public class menuactivity extends sherlockactivity implements actionbar.onnavigationlistener,
since actionbarsherlock has been deprecated, can use toolbar class appcompat-v7
library.
on gradle file, add:
dependencies {
compile filetree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
}
for layout, can use this:
<android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="0dp" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:local="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/tools" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="?attr/actionbarsize" android:background="?attr/colorprimary" app:layout_scrollflags="scroll|enteralways" local:theme="@style/themeoverlay.appcompat.dark.actionbar" local:popuptheme="@style/themeoverlay.appcompat.light" /> </android.support.design.widget.appbarlayout>
on menuactivity.java:
public class menuactivity extends appcompatactivity{ @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_menu); final mtoolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(mtoolbar); }
on styles.xml file:
<resources> <!-- base application theme. --> <style name="apptheme" parent="mymaterialtheme"> <!-- customize theme here. --> </style> <style name="mymaterialtheme" parent="mymaterialtheme.base"> </style> <style name="mymaterialtheme.base" parent="theme.appcompat.light.darkactionbar"> <item name="windownotitle">true</item> <item name="windowactionbar">false</item> </style> </resources>
Comments
Post a Comment