Android :: Set Styles Programmatically
Feb 3, 2009
Given a widget and a int that references a style (defined in my res/ values/style.xml), what is the 'correct' way to programmatically apply the style to the widget?
Up until now I've been hacking this by...
CODE:..................
View 5 Replies
Sep 11, 2010
In an Android application I am writing, the styling for my various TextView elements is defined in an xml resource. I would like enable the user to change certain styles such as android:typeface using a PreferenceActivity. Is there a way to modify a style resource programmatically such that all associated widgets will update correctly? If not, must I manually select all widgets by id and change their styling?
View 1 Replies
View Related
Jan 24, 2009
For Style and Thems defination, CSS is considered to be a better standard...(as it has seen many revisions and widely used already in the web areas).. Any reason, why Android using XML approach as opposed to CSS.. Are there any plans of support of CSS too in future..
View 5 Replies
View Related
Sep 3, 2010
I want to enable different themes in my app. Some elements need "special" variations, like, for example, a headline TextView. Lets say for the example, in theme A, I want the headline yellow on black, in theme B red on white, while the default TextView uses black on white and vice versa.
Now, I can style the default TextView pretty easy by using <item name="android:textViewStyle"> with a different TextView style in each Theme style.
For example:
CODE:............
But how can I do it with the headline? As far as I know, I can use style="..." in the layout XML. But there, I can only use an item style like "headlineForBlack", which would ignore the current theme, while I'd rather need something like "style 'headline' for the current theme".
View 5 Replies
View Related
Nov 9, 2009
I have defined some attributes in my view and I can assign them like:
CODE:................
This works. But when I want to do the same thing with styles.xml:
CODE:.................
I get "No resource found that matches the given name".
View 5 Replies
View Related
Sep 19, 2009
Where can I find default styles for my widgets? Let me give you an example. In the Contacts application, when adding a new contact, at the very bottom there are two buttons that have a particular background. I have traced that to here: http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git;... and it would seem that that background is achieved by using style="@android:style/ButtonBar" on a LinearLayout. From what I understand, this is a system-wide theme default for button bars. However, what I am searching for is not a ButtonBar, but similar, so I tried searching for this ButtonBar in the documentation, hoping to find other similar styles I could use. I *thought* I would find it in R.style:[url]
View 4 Replies
View Related
Oct 7, 2009
I would like to load new themes/styles from the web to replace the current ones. Is that possible? As far as I can see those resources are read-only.
View 5 Replies
View Related
Nov 25, 2009
I would like to make some small changes to the style of the built-in TabWidget (i.e. make the height smaller and change some colors).
View 2 Replies
View Related
Jun 30, 2010
Where can I see what typeface, size, color, etc. are used for Android's pre-defined text styles? Like the default text style or textAppearanceMedium, for example?
View 3 Replies
View Related
Sep 7, 2009
I'm supposed to develop an app which behave like that: The User starts the app and can select between different configurations. Depending on the selection there are different colors, drawables and strings (e.g. urls for webservice-calls) to display. All the code-stuff is the same.
My first intention to do so was themes.... - is it possible to include somehow strings in themes? - what shall I do with styles which are referenced in some layout-xml (which are the same for all configs) and should use different colors. can't define colors or styles multiple times and don't want to change that manually (when user selects by code).
View 2 Replies
View Related
Apr 22, 2010
Is it possible to display Css style tags in a text view..? The method Html.fromhtml() converts only html tags to a spanned string but not the Css styles
View 3 Replies
View Related
Jan 28, 2010
An important part of creating an android application is making the gui look right. However where do I find documentation for this. An example of what I am looking for is something like this
style="@android:style/ButtonBar"
what other interesting styles does exist. The eclipse layout xml editor knows about some of the @android:style/'s but not this one. Where is all this documented?
View 5 Replies
View Related
Aug 28, 2010
I like Handcent SMS but can't decide on a custom style. can anyone suggest style settings or if you are able to post screens of your Handcent SMS setup. Show me your styles!
View 2 Replies
View Related
Apr 1, 2010
I'm defining a style XML for my android app. I have some TTF files I want to use, how can I set the typeface to use those files as the font as opposed to the generic "sans", "serif" & "monospace".
View 2 Replies
View Related
Sep 7, 2010
I would like to create an xml selector of styles.
Basically i would do something like that:
CODE:.................
View 1 Replies
View Related
Mar 16, 2009
Is there a way to change the Alert Dialog style, like background and font color using something like
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme" parent="android:Theme"> </style> <style name="Theme.Dialog"> <item name="android:colorBackground">#FF0000</item> <item name="android:colorForeground">#00FF00</item> </style> </resources>
View 3 Replies
View Related
Dec 23, 2009
Do you know if it's possible to apply a theme or a style on a OptionMenu ? I don't find tag in R.style or R.styleable to customize it and apply a theme.
View 3 Replies
View Related
Dec 15, 2009
I've got a text style defined in styles.xml. I'm trying to reference it from a layout. When I reference from the layout, it causes an exception upon inflation. If I use the style from java code, it works fine. Setting the individual styles on the TextView works fine too:
CODE:..............
View 3 Replies
View Related
Jan 6, 2010
Im trying to figure out how to use Styles. It seems easy, but its not working.
First, here is my XML for the Button:
<Button style="@style/Btest" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Some text"></Button>
And here is the values/styles.xml:
CODE:...........
Its not working at all. If I dont use Style and just add the style directly in the XML for the Button - no problem.
View 2 Replies
View Related
Sep 21, 2009
In the ApiDemos, there is a view example called Gallery1 which declares a custom style in attrs.xml.I want to do the same thing for my widgets, but using a different namespace. However, as soon as I replace the android: namespace with something else,Unable to find attribute? Why does it look for an attribute I am about to declare? Isn't the point of this file to be able to name your own custom attributes?It's interesting to note that it works if you do not supply a custom namespace, but just an attribute name.
View 2 Replies
View Related
Jun 19, 2010
I am new to Android app. development. I need to change the existing style at runtime or can create new styles at runtime and I need to apply it for my buttons and textviews.
View 3 Replies
View Related
Oct 7, 2009
I was wondering if its possible to set multiple styles for different pieces of text inside a TextView. For instance, I am setting the text as follows:
CODE:...........................
Now, is it possible to have a different style for each text element? I mean bold for line1, normal for word1 and so on...
I found this http://developer.android.com/guide/appendix/faq/commontasks.html#selectingtext:
Get our EditText object. EditText vw = (EditText)findViewById(R.id.text);
Set the EditText's text. vw.setText("Italic, highlighted, bold.");
If this were just a TextView, we could do: vw.setText("Italic, highlighted, bold.", TextView.BufferType.SPANNABLE); to force it to use Spannable storage so styles can be attached. Or we could specify that in the XML.
Get the EditText's internal text storage. Spannable str = vw.getText();
Create our span sections, and assign a format to each.
CODE:............................
But it uses position numbers inside the text. Is there a cleaner way to do this?
View 3 Replies
View Related
Oct 27, 2010
Currently my ListView is filling up with the given String[] but I wanted to alternate some styles on the ListView items. Something weird is happening (I'm surely missing something obvious); The ListView Index is not fixed and the styles are not alternating as supposed. My Code is the following:
import android.app.ListActivity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;..................
View 3 Replies
View Related
Aug 10, 2010
In my Android application I've hidden the default title bar, introduced a TabView and added my own titlebar under that TabView's tabs. At the moment, I'm using the ?android:attr/windowTitleStyle style which makes my new titlebar look gray and gradient. It looks pretty good, but my screens are looking pretty grayscale. I'd like to spice things up a bit by making this titlebar a different color gradient.
What am I looking at here? Creating my own image and using it? The ?android:attr/windowTitleStyle style seems to expand depending on the height of your custom titlebar; so I'm not sure it's actually a single image.
I've attempted to throw a LinearLayout over it with a bit of translucency (ex: making the color #800000FF), but the gradient style I have behind this LinearLayout disappears.
Update:
Per my answer down below, I've figured out that I can create an XML file that defines a gradient and use that. It works fine inside a LinearLayout (titlebar_gradient) I have on my layout. However, it is not working on the outer-most LinearLayout (background_gradient). Could someone tell me why? As I understand it, the ListView should be transparent...
code:...............
View 1 Replies
View Related
Jul 12, 2010
Super compass is a compass in the English tools. There are many styles and backgrounds to choose from, the essential software for your trip.
Super compass, both app and home screen widget, several styles and backgrounds to choose.
Version 1.4:
- show GPS location
- show current address
- GPS status
- connectivity status
Feature
- Home screen widget
- change background
- change style
- calibrate
- GPS location, address
View 1 Replies
View Related
Dec 11, 2009
Is it possible to style a single, say, TextView in Android with multiple alternating styles, colors, and sizes? Think inline HTML or CSS but in the Android world. As an extreme, to demonstrate the point, let's say I wanted to have a word "CIRCUS" with each letter a being different color. Do I have to create 6 TextViews for this or can this be done in one?
View 1 Replies
View Related
Jun 30, 2010
Ever since I added conditional text formatting on my list items I've noticed a performance drop. It's still usable but I'm somewhat obsessive about performance/experience so I would really like to tweak my approach as best I can. The following snippet is how I'm achieving my conditional formatting. Is this the only way? (Perf drop appears to be related to making TextViews spannable)
CODE:....................
View 3 Replies
View Related
Jun 28, 2010
Is there a way to change styles for Gallery? For example, borders, animation speed. Maybe there is list of predefined themes?
View 1 Replies
View Related
Aug 13, 2010
I'd like to dynamically apply styles to my views at runtime.
Is there any method like View.setStyle(int style)?
View 1 Replies
View Related
Apr 15, 2010
I want to refer to a static Java variable in my styles.xml, is that possible? Here's a pseudo-xml example:
<style name="Artwork">
<item name="android:background">@drawable/border_{Constants.MY_COLOR}</item>
</style>
View 1 Replies
View Related