Sometimes the top of the activity we need to customize the style, this time we need to hide actionbar. Two different ways:
1. Hide by Android:theme= "" Property in the configuration file:
<activity android:name= ". Mainactivity " android:label=" @string/app_name " <!--this line of code can hide Actionbar--- android:theme=" @ Android:style/theme.light.notitlebar "> <intent-filter> <action android:name=" Android.intent.action.MAIN "/> <category android:name=" Android.intent.category.LAUNCHER "/> </intent-filter></activity>
2. Hide in activity code:
public class Mainactivity extends Activity { ActionBar ActionBar;//Declaration ActionBar @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); ActionBar = Getactionbar (); Get to Actionbaractionbar.hide (); Hide Actionbar }}
How to hide Actionbar in Android