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
Related
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">
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
I am looking for a drop down menu similar to this for my Droid app, i would prefer to not home brew it if something already exists:
Closet thing i know of is:
http://www.pavanh.com/2013/05/android-popup-menu-example.html
then perhaps find a way to use a custom 9 patch to make your bubble type effect.
Your activity should be styled as a Dialog.
You need to update your AndroidManifest.xml, add :
<activity
android:name="package.activity"
android:theme="#android:style/Theme.Dialog">
And then customize your theme to approach your bubble idea...
Edit: Muhammad has useful answer too, it's more like a popup window that you need, see
http://androidituts.com/android-popup-window-tutorial-2/
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.
Can you please tell me why the android Contacts application theme/style is using 'dark' theme? For example, the activity's background is Black instead of White.
I have looked at their Android Manifest xml file and their layout xml file (e.g. call details.xml) file, but i don't see how they specified using a 'dark' theme?
Can you please tell me how do they do that? I have looked at http://developer.android.com/guide/topics/ui/themes.html, but I don't see Contacts app is doing that.
Thank you for any help.
The dark theme is the default in Android, if you do not specify otherwise.