I´m noob in the android programming area, and I have a big problem with changing the theme in eclipse!! The app runs nice with the predetermined theme, when I change it i did this:
1) go to the manifest > Application > select "Browse" > this theme: #android:style/Theme.Black.NoTitleBar.Fullscreen (did apear at the code)
2) activity_Main > I selected the same theme but didn´t apear at the code.
thats it! and when i run it the AVD says: "The application Bola de cristal (Process com.RMapps.boladecristal) has stopped unexpectedly. Please try again"
I dont know what to do! please someone has an idea? thanks in advanced!!
Excuse my english, its not my first language.
Take a look at the actual XML of the manifest. You should see your theme under application:
<application
android:theme="android:style/Theme.Black.NoTitleBar.Fullscreen
This will apply the themem to all activities that don't explicitly override it.
In Eclipse, when viewing the activity designer, you can select themes from a dropdown and you will see the change take place in front of you but this will not actually save and compile for you. So when you run your app, you will be a bit confused. You need to explicitly declare the theme for an activity under that activity def in the manifest, just like you did for the application as a whole.
<activity
android:theme="android:style/Theme.Black.NoTitleBar.Fullscreen
But again, you don't need to do this if you want to use the theme that you set at the application level.
If your app is still crashing then you have another problem going on. Perhaps the theme you are selecting isn't actually present or maybe you have another bug you didn't realize you introduced during the time of adjusting the theme
Related
When ever I load my app on android I get a grey screen with the words "player needed"(the apps name) across the top for about a second before my app actually starts. It does not appear on the development testing app only when I do an actual build, and then only when I start the app. If I change windows back and forth it does not appear again. How can I remove this?example of grey screen
Thank you!
You could try this, worked for me, it's something about the MainActivity theme on Android.
In the "platforms\android" folder under your project, open the AndroidManifest.xml and search for android:theme inside the <activity> tag that contains android:name="MainActivity" and change the default value (that is android:theme="#android:style/Theme.DeviceDefault.NoActionBar") to android:theme="#android:style/Theme.Translucent". Save the file and build your project again, the grey screen should desapear.
In My application :
setTheme(R.style.sometheme)
does not work same when theme is set in manifest, for activity tag as below:
android:theme="#style/sometheme"
I need to set the theme dynamically, in the android application onCreate . I can't do this, since the behavior of both the implementations is different.
Any help would be greatly appreciated.
Got it..
'setTheme(R.style.sometheme)' takes some time to apply, so if you put certain delay, you could see it. Where as if you apply the theme in manifest, it is applied instantly.
I'm having trouble modifying the default application theme in Android Studio.
As a really simple test I just want to remove the default ActionBar in a default starting project. I do this by setting a "NoActionBar" theme in the preview pane. When I run the application however, no changes are applied.
Is modifying the theme of an application in AndroidStudio through the preview pane the correct way of applying said theme to your application?
Are there any additional steps that need to be taken to apply the changes and if so, what are they? (if thats the case, its not exactly intuitive that changes in the preview pane don't show up in your actual application)
First, have a look at this answer https://stackoverflow.com/a/29001288/4188219
So, the selected theme for preview is just a way to let you know what effect the selected theme will be, but if you want use some theme to your app when run on device, you must define it in xml or code. That is to say, the preview theme does not affect the actual theme of app.
If you want to remove the action bar then in your manifest file in activity tag enter <android:theme="#android:style/Theme.NoTitleBar">
and also you can start your activity like public class yourclass extends Activity instead of extends ActionBarActivity
Hope it helps ...
you should change theme in Manifest or activity class, something like this:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
The easiest way is to simply define the theme the entire application uses, by mentioning it in the manifest file, under the application tag as below, (Since I wanted a dark actionbar so I mentioned that)
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.DayNight.DarkActionBar">
At the moment im using:
android:theme="#android:style/Theme.Black.NoTitleBar"
Which I'm growing a bit bored of, Is there a link you can direct me to that shows me examples of all the inbuilt themes and their names?
I read on another post that there is quite a few so it would be best if there was a website/other source that could show me some previews :)
Thanks for the help!
Your IDE (I know Android Studio does), should show you them.
Otherwise, here they are in raw xml form. https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml
More information on Android Dev docs: http://developer.android.com/guide/topics/ui/themes.html
You can see all the theme names in the manifest.xml. For this see the following snapshot:
Android Studio has a Theme Editor which provides preview function.
User can find all built-in themes inside.
2 ways to open it:
Open a styles XML file, for instance res/values/styles.xml. Then click Open editor near the top-right of file-editing window.
in top menu bar Tools-Android-Theme Editor.
I'm pretty noobish with it all but basically I think there are only two themes. Day/Night and Light. You can select individual parts and change them but as far as I can tell there are only two themes.
As I had a comment that said this doesn't answer the question I will add that you can use Theme.AppCompat.DayNight or Theme.AppCompat.Light in the AndroidManifest.xml or in styles.xml and edit any individual attribute but there are about a million attributes and god only knows what they all do. In my opinion it's a massive oversite by android.
In an Android book I have it says that themes can be applied to and entire activity or an entire application. It doesn't show how but the Android docs say to simply put the theme statement into the androidmanifest.xml file like so....
<application android:icon="#drawable/ic_launcher">
<activity android:theme="#style/bigred" . . . .
but it doesn't work. Only the application bar is styled with the big red type and the text in other widgets is not styled at all. How is this supposed to be done?
Also the docs say that to see what styles are available from Android to read the code! Any better docs than this?
Follow these tutorials it also helped me.customized-title and customized-title.
Try using actionbarsherlock.Go through their sample codes from this website.
Please review the following: How to Apply Styles to the all UI in Android