Thanks for the pointer.

I don't know where to do that at.

I haven't branched out that far. Can you point me farther?

Thanks


"What appears to be coming at you, is coming from you" - Jack Flanders




On Mon, Mar 22, 2010 at 11:00 AM, jotobjects <[email protected]> wrote:

> It would be great if you file the documentation problem as a bug -
> there are lots and lot of them.  Jut mentioning it on this list
> doesn't get it fixed!
>
> On Mar 9, 10:18 am, Brion Emde <[email protected]> wrote:
> > I've confirmed that when you declare a ColorDrawable in the colors.xml
> > file, then get it via:
> >
> > ColorDrawable cd = (ColorDrawable)
> > getResources().getDrawable(R.drawable.red_drawable);
> >
> > that it does indeed work. This shows that the real Bug is in the
> > documentation here:
> >
> > http://developer.android.com/intl/de/guide/topics/resources/available...
> >
> > where it states that what is returned is a PaintDrawable, which would
> > have allowed setting of bounds.
> >
> > Also, a ways down in that same section, there is a Java example of how
> > to use it:
> >
> > // Assign a PaintDrawable as the background to
> > // a TextView on the current screen.
> > Drawable redDrawable = Resources.getDrawable(R.drawable.solid_red);
> > TextView tv = (TextView)findViewByID(R.id.text);
> > tv.setBackground(redDrawable);
> >
> > This example is wrong. There is no setBackground() function that takes
> > a Drawable. There is setBackgroundDrawable(). I think the example
> > should be updated also, since the developer's guide is so important
> > and resources are so central to the platform.
> >
> > On Mar 8, 8:56 pm, Romain Guy <[email protected]> wrote:
> >
> > > This is not a bug, a PaintDrawable ignores its bounds. You want a
> > > ColorDrawable instead.
> >
> > > On Mon, Mar 8, 2010 at 7:23 PM, Brion Emde <[email protected]>
> wrote:
> > > > I posted earlier with a less clear title. Unless someone can show me
> > > > differently, I think I've found another bug in TextView.
> >
> > > > res/values/colors.xml:
> >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <resources>
> > > >        <drawable name="red_drawable">#FF0000</drawable>
> > > > </resources>
> >
> > > > res/layout/main.xml:
> >
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <TextView xmlns:android="http://schemas.android.com/apk/res/android";
> > > >        android:id="@+id/textview"
> > > >    android:layout_width="fill_parent"
> > > >    android:layout_height="wrap_content"
> > > >    android:text="There should be a red strip at the bottom of this
> > > > view, not a red background"
> > > > />
> >
> > > > src/eyebrowssoftware/showcompounddrawablesproblem/ShowIt.java:
> >
> > > > package com.eyebrowssoftware.showcompounddrawablesproblem;
> >
> > > > import android.app.Activity;
> > > > import android.graphics.drawable.Drawable;
> > > > import android.os.Bundle;
> > > > import android.widget.TextView;
> >
> > > > public class ShowIt extends Activity {
> >
> > > >    @Override
> > > >    public void onCreate(Bundle savedInstanceState) {
> > > >        super.onCreate(savedInstanceState);
> > > >        setContentView(R.layout.main);
> >
> > > >        Drawable paintDrawable =
> > > > getResources().getDrawable(R.drawable.red_drawable);
> >
> > > >        TextView tv = (TextView) findViewById(R.id.textview);
> >
> > > >        // setBounds must be called before setCompoundDrawable(), but
> > > > it does not matter.
> > > >        // this should be a 5 pixel high rectangle the width of the
> > > > text.
> > > >        paintDrawable.setBounds(0, 0, tv.getWidth(), 5);
> >
> > > >        // no matter what you set the bounds to, it becomes the
> > > > background of the textview, not underline,
> > > >        // which is also there
> > > >        // this should put the 5 pixel high rectangle below the text,
> > > > which it does, but it also sets the background
> > > >        tv.setCompoundDrawables(null, null, null, paintDrawable);
> >
> > > >        // this padding seems irrelevant
> > > >        tv.setCompoundDrawablePadding(2);
> > > >    }
> > > > }
> >
> > > > And here is how it appears, which I think is highly wrong:
> >
> > > >http://www.vonemdeheim.com/picture_library/CompoundDrawablesBug.jpg
> >
> > > > Please point out where I made a mistake. Thanks for your attention.
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<android-developers%[email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > Romain Guy
> > > Android framework engineer
> > > [email protected]
> >
> > > Note: please don't send private questions to me, as I don't have time
> > > to provide private support.  All such questions should be posted on
> > > public forums, where I and others can see and answer them
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> To unsubscribe from this group, send email to android-developers+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to