Got it.

To answer all of my own questions:

1)  ADT layout editor doesn't show the result of when you set a style
property.
2)  http://developer.android.com/reference/android/R.styleable.html is
everything that can be an item in a style.
3)  http://developer.android.com/reference/android/R.style.html are
all the parent styles that you can extend.
4)  android:Theme is the default theme.
5)  The following code works fine.

<resources>
        <style name="MenuButton" parent="android:Widget.Button">
                <item name="android:textAppearance">@style/MenuButtonText</item>
        </style>
        <style name="MenuButtonText">
                <item name="android:textSize">12pt</item>
                <item name="android:textColor">#FFF</item>
        </style>
</resources>

        <Button android:layout_width="wrap_content"
                android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
                android:width="220px" android:text="@string/some_string"
android:id="@+id/my_button"
                android:height="50px" android:layout_marginTop="10px"
                style="@style/MenuButton" />



On Jun 3, 2:22 pm, Robert Green <rbgrn....@gmail.com> wrote:
> Also, When I say that, "nothing happens" when I do the above example,
> I'm saying that nothing happens in the ADT editor.  I haven't tried
> running it like that, I've just tried to see it work in the preview.
>
> Should a style setting show up in the ADT layout editor?
>
> On Jun 3, 2:09 pm, Robert Green <rbgrn....@gmail.com> wrote:
>
> > Ok I think I may understand the problem but leads me down a very
> > frustrating path.  I think that if I were to set a style on a view,
> > that style would need to inherit the default style and then override
> > the values that I want to have custom.  That's fine and all, but I
> > have no idea where this magic list of default styles is or what the
> > values are in it.
>
> > I have scoured the developer's documentation starting here 
> > -http://developer.android.com/guide/topics/ui/themes.htmlandcan not
> > find this information anywhere.
>
> > Basically, I have no idea what style to extend and I can't find the
> > resources I need to figure it out.  I don't even know what the default
> > theme is.  Does anyone?
>
> > On Jun 3, 12:19 pm, Robert Green <rbgrn....@gmail.com> wrote:
>
> > > I finally decided to use styles and themes instead of tediously
> > > setting attributes for each individual view.  I was able to get the
> > > style to work when I set it on android:textAppearance, but when I try
> > > to just set it right on the style attribute like below, it no longer
> > > applies.  This is happening to me for Buttons as well as TextViews.
> > > What I want is to be able to have a few different styles for text
> > > views and buttons and then just set the style on each button or text
> > > view.  The style will need to define textSize, textColor, background
> > > and maybe a few others.  Since background and some other things are
> > > not textAppearance, I need to use the general style attribute.
>
> > > Here's my current attempt:
>
> > > In one of my menu layouts, I have a title, which looks like this:
>
> > >         <TextView android:layout_width="wrap_content"
> > >                 android:layout_height="wrap_content" 
> > > android:text="@string/
> > > title_1_text"
> > >                 android:layout_gravity="center_horizontal" 
> > > android:id="@+id/title"
> > >                 android:layout_marginBottom="20px" 
> > > android:layout_marginTop="10px"
> > >                 style="@style/MenuTitle"></TextView>
>
> > > then in res/values/styles.xml
>
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <resources>
> > >         <style name="MenuTitle">
> > >                 <item name="android:textSize">16pt</item>
> > >                 <item name="android:textColor">#FFF</item>
> > >         </style>
> > > </resources>
>
> > > Any ideas on what I'm doing wrong here?  I would think that the style
> > > attribute being set to the MenuTitle style would then apply the
> > > android:textSize and android:textColor, but I appear to be missing
> > > something.
>
> > > I have no themes defined yet.  I'm considering doing that once I get
> > > this working because all of the layout backgrounds and button styles
> > > in my app will be the same.
>
> > > Thanks for any help!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to