Friday, July 12, 2019

Android Studio - Action Bar remove

Android Studio - Action Bar remove




Android studio is open source for mobile application development for IOS and Android. Today i am going to discuss about android Studio how you can remove the action bar from top. Before you start if you are new in android studio you can check this tutorial. how to install android studio in windows machine.


class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.my_activity)
supportActionBar?.hide()
}
}
This line supportActionBar?.hide() did the job. Start the app, and it works.


Though the XML with theme


First, add a new style in the styles.xml:

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Then, open the AndroidManifest.xml and apply it to the activity you want to hide the action bar. Start the app, and it works.
 <activity
android:name=".ui.MyActivity"
android:theme="@style/AppTheme.NoActionBar"
/>

Android Studio - Action Bar remove

Android Studio - Action Bar remove Android studio is open source for mobile application development for IOS and Android. Today i am ...