java - How to add Material Design on my app -
java - How to add Material Design on my app -
i have big problem. eclipse (i have latest api , sdk of android 5.0) trying transform app material design. problem eclipse seems unable recognize code. i'll seek detailed: principal code:
main activity.javapublic class mainactivity extends activity implements onclicklistener { private final static string radio_station_url = "http://178.32.137.180:8665/stream"; private progressbar playseekbar; private button buttonplay; private button buttonstopplay; private mediaplayer player; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initializeuielements(); initializemediaplayer(); } private void initializeuielements() { playseekbar = (progressbar) findviewbyid(r.id.progressbar1); playseekbar.setmax(100); playseekbar.setvisibility(view.invisible); buttonplay = (button) findviewbyid(r.id.buttonplay); buttonplay.setonclicklistener(this); buttonstopplay = (button) findviewbyid(r.id.buttonstopplay); buttonstopplay.setenabled(false); buttonstopplay.setonclicklistener(this); } public void onclick(view v) { if (v == buttonplay) { startplaying(); } else if (v == buttonstopplay) { stopplaying(); } } private void startplaying() { buttonstopplay.setenabled(true); buttonplay.setenabled(false); playseekbar.setvisibility(view.visible); player.prepareasync(); player.setonpreparedlistener(new onpreparedlistener() { public void onprepared(mediaplayer mp) { player.start(); } }); } private void stopplaying() { if (player.isplaying()) { player.stop(); player.release(); initializemediaplayer(); } buttonplay.setenabled(true); buttonstopplay.setenabled(false); playseekbar.setvisibility(view.invisible); } private void initializemediaplayer() { player = new mediaplayer(); seek { player.setdatasource(radio_station_url); } grab (illegalargumentexception e) { e.printstacktrace(); } grab (illegalstateexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); } player.setonbufferingupdatelistener(new onbufferingupdatelistener() { public void onbufferingupdate(mediaplayer mp, int percent) { playseekbar.setsecondaryprogress(percent); log.i("buffering", "" + percent); } }); } @override protected void onpause() { super.onpause(); } };
styles.xml on res/values <resources> <!-- base of operations application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. --> <style name="appbasetheme" parent="@android:style/theme.black"> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> </style> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <!-- customizations not specific particular api-level can go here. --> </style> </resources>
i trying follow guide -> http://android-developers.blogspot.gr/2014/10/appcompat-v21-material-design-for-pre.html i'm blocked after first point, extension of activity actionbaractivity
(done)... can have help? want apply material design (black) app.. can help me? i'm bit new in part of android, so, detailed.
you need add together dependency in project appcompatv7
library back upwards material design on devices lover sdk 5.0
here instructions how setup appcompat
library in eclipse: https://developer.android.com/tools/support-library/setup.html
after need define theme this:
<style name="appbasetheme" parent="theme.appcompat"> </style>
and activities extend actionbaractivity
:
public class mainactivity extends actionbaractivity { }
java android eclipse material
Comments
Post a Comment