Hello, i want to delete the banner that appears at the top of the MaterialApp only happens on Android, in iOs i don't have that issue.
I used the very_good cli
I tried to view if the android_manifest.xml have some information but i didn't find anything that could help me.
I am expecting to delete the black banner with the appName
This could be an AppBar which is located inside a Scaffold. Try looking for it in the project and delete it.
Alternatively this could be based on the android activitie's theme. In the android specific module, open the manifest.xml file and check which themes are used in the activities:
<manifest ...>
<application
...>
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
...
</activity>
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
...
</application>
</manifest>
In this case, flutter uses LaunchTheme and after the launch it applies NormalTheme.
Open then the styles.xml file (usually located at: android/app/src/main/res/values/styles.xml). Find the styles that match the styles which are used by the activity and check if they both inherit from a NoTitleBar style.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="#android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
Related
I can't seem to show my own splash screen, every time I launch the app the default, blank splash screen is shown even though I've set up everything in launch_background.xml and the other files in res. I've also set up all the relevant icons in drawable and mipmap.
launch_background.xml:
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<color android:color="#color/splash" />
</item>
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="#drawable/splash_icon" />
</item>
</layer-list>
styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="#android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">#drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="#android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#191919</color>
<color name="splash">#191919</color>
</resources>
<activity> tag in AndroidManifest.xml:
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/LaunchTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
The splash screen should show an image and a different background color but instead it just shows the default blank white screen. I'm not using a custom splash screen for this. I just want at least the colors to change but even that is not working.
Also make the changes in drawable-v21/launch_background.xml. This will be used for Android API Level 21 or higher.
Pub.dev has a package that will create the native splash screens for you: flutter_native_splash
I am just beginning to learn Android Studio (version 2.0, running on Windows 7). When I create a new project (Empty Activity template) Android Studio places a header at the top of the project. How can I remove the header?
Here's a picture of the problem. I want to get rid of the 'My Greeting Card' header.
You have to simply navigate like below....
app -> res -> values -> styles.xml
Find <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> line.
Theme.AppCompat.Light.DarkActionBar line shows, how your activity will look like.
There are lots of Themes available. Just remove DarkActionBar it and press Cntrl+Space to explore another themes. In your case, you do not want Header which is called ActionBar in Android Terminology.
So, Just change theme to Theme.AppCompat.Light.NoActionBar and you are done.
To get more deeply about how the theming work and other courses of Android, Just try Pluralsight. Go to below link and get 6 months free subscription. It is very good website to learn any technology.
Pluralsight 6 Months Subscription
Well the answer is already given, but still i would like to add if you don't want any kind of actionbar on top of the activity simply do this.
go to your res->values->styles.xml and add these xml code
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#3F51B5</item>
<!-- Light Indigo -->
<item name="colorPrimaryDark">#3949AB</item>
<!-- Dark Indigo -->
<item name="colorAccent">#00B0FF</item>
<!-- Blue -->
</style>
<style name="AppTheme" parent="AppTheme.Base"></style>
</resources>
and reference the theme in the style on any activity you want, like below in the manifest using android:theme=#style/AppTheme.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailActivity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
</application>
you can hide Toolbar using
getActionBar().hide();
or
getSupportActionBar().hide();
For Newer Version
app -> res -> values -> themes -> themes.xml
In that it also depends whether the phone is in night mode or not.
Then You have to modify both the files:
themes.xml
themes.xml (night)
with
parent="Theme.MaterialComponents.DayNight.NoActionBar"
just Remove AppCompatActivity and extend it with only Activity
I am trying to create this theme for one, and just one of my activities:
Since I am learning how this styles work, and I am now beginning to be aware that we have more different & incompatible ways of styling in android than atoms in the whole universe. So I've tried to learn from this site: http://jgilfelt.github.io/android-actionbarstylegenerator
However when I try to apply its theme in my project that is using AppCompat I get the
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
error type.
I am extending from ActionBarActivity in my tabbed activity and I don't feel safe going back now (someone suggested extending Activity to solve this issue), since in previous posts I was suggested to use AppCompat, and ActionBarActivity seems somehow to be AppCompat related.
I've spent all my week googling for solutions and I've came across these problems:
The official Android styling documentation is deprecated.
The code generated by Android Studio is also deprecated in method such as this.*
http://jgilfelt.github.io/android-actionbarstylegenerator is deprecated.
BUT, to the point now, this is what I have at the moment:
So, the only thing I am not being able to do is
putting the logo in the top left corner of the screen (in the action bar), in a way that only affects the action bar of this particular activity, (Done)
make the orange bar showing which tab is selected.
How can I achieve this in the most simple way?
This is my values/style.xml file:
<resources>
<!-- Base application theme. -->
<style name="SmartCampusTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/actionbar_bg_color</item>
</style>
<style name="GenericProgressIndicator" parent="#android:style/Widget.ProgressBar.Small">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:indeterminate">true</item>
</style>
</resources>
My AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="greensmartcampus.eu.smartcampususerfeedbackapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:logo="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/SmartCampusTheme">
<!-- Splash screen while connecting to the web-server -->
<activity
android:name=".HomeScreen"
android:label="#string/title_activity_home_screen"
android:parentActivityName=".AbstractPortraitActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="greensmartcampus.eu.smartcampususerfeedbackapp.AbstractPortraitActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- The activity where all actions take place -->
<activity
android:name=".ControlActivity"
android:label="#string/title_activity_home_screen"
android:parentActivityName=".AbstractPortraitActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="greensmartcampus.eu.smartcampususerfeedbackapp.AbstractPortraitActivity" />
</activity>
</application>
</manifest>
*Ps. it's funny how the most up-to-date Android Studio generates deprecated code for tabbed activities and then complains about it being deprecated as if it is your fault...
Important Note: I am a huge fan of MVC and a modularity priest (OSGi practitioner). So I would love if all these styling solutions could be all contained in the style and drawing XML files (as they should be if I correctly recall), the layout information is all contained in my layout files and my java files only contain code about behavior. For example I could just show the action bar icon with java through getSupportActionBar().setDisplayShowHomeEnabled(true), but inserting layout related stuff in java disrupts the MVC pattern. Also, the website that I mention above can create the layout with the icon in the actionbar without using a single java line. I just need to know how can that be done with AppCompat, which apparently is what I am using because other solutions are deprecated.
I managed to get this done a few days back but now I've forgotten what steps I took to make it work.
I've generated a custom widget theme from http://android-holo-colors.com
I've copied it to my res folder. I need to know what to change in the manifest and the styles.xml file to make it work with my app. I've tried a lot of different things but the theme either doesn't change or generates and xml error.
manifest.xml
<activity
android:name="com.yourapp.app"
android:label="#string/app_name"
android:screenOrientation="landscape"
android:theme="#style/Theme.YourTheme"
...
</activity>
res/values/styles.xml
<style name="YourTheme" parent="android:Theme.Light">
...
</style>
When I created new Android application in Eclipse.In its AndroidManifest.xml the theme set to application isandroid:theme="#style/AppTheme"& style.xml is as follows.
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
</resources>
& my screen appears like this.
I want to remove the TitleBar from app but want to show the theme of Android 4.1's.
For this I tried
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.Light.NoTitleBar" >
Now my screen appears like this the TitleBar is removed but theme has changed.
Please help me to sort out this issue.
Use this instead : #android:style/Theme.Holo.NoActionBar.
Try out putting this in your manifest.
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"