You have two ways to hide the title bar by hiding it in a specific action or by hiding all actions in your application.
This can be done by creating a custom theme in styles.xml .
<resources> <style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> </resources>
If you use AppCompatActivity , there are many themes that Android currently supports. And if you choose a theme with .NoActionBar or .NoTitleBar . It will disable your action bar for your theme.
After setting up a custom theme, you can use the theme in your activities / actions. Go to the manifest and select the action on which you want to install the theme.
SPECIFIC ACTIVITIES
AndroidManifest.xml
<application android:icon="@mipmap/ic_launcher" android:label="@string/app_name"> <activity android:name=".FirstActivity" android:label="@string/app_name" android:theme="@style/MyTheme"> </activity> </application>
Please note that I installed the FirstActivity theme in MyTheme custom theme. Thus, the topic will be affected only by certain activities. If you do not want to hide the toolbar for all your activities, try this approach.
The second approach is where you set the topic for all your activities.
ALL ACTIVITIES
<application android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/MyTheme"> <activity android:name=".FirstActivity" android:label="@string/app_name"> </activity> </application>
Please note that I have installed the application theme in the custom MyTheme theme. Thus, the topic will be affected only in all activities. If you want to hide the toolbar for all your activities, then try using this approach.
UmarZaii Jul 26 '17 at 17:53 on 2017-07-26 17:53
source share