I'm developing an application where I set up an activity for the settings. I tried to use the android studio template to create an activity setting but the structure of the code that is being created is too complex. Can anyone tell me how to create a settingsActivity similar to the android studio template but without headers? Thanks in advance for the answer. Greetings.
How to create a single activity without headers
370 Views Asked by Mirko Marasco At
2
There are 2 best solutions below
1
On
In the styles.xml file, please make one style tag if you want to remove actionbar(you said header) in only specific activity.
<style name="AppTheme1" parent="Theme.AppCompat.Light.NoActionBar" />
And goto AndroidManifest file, please apply above style to your activity something like this.
<activity android:name=".SettingActivity" android:theme="@style/AppTheme1"></activity>
if you want to remove actionbar in all of your activities, then you can change AppTheme style in the styles.xml file like below.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/mainColor</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
... ...
To create a single settingActivity you can try the below pseudo code:
Then
settings_preference.xmlcode: