Text in of a custom drawable

by Erik H » Wed, 01 Apr 2009 18:11:19 GMT


Sponsored Links
 Hi,

I need help to add text in a custom drawable. I'm looking in tha API
(android.graphics...) but cannot find any way of doing this.

What I basically want is a drawable that contains text that I can
change. Is this even possible today?

It must be a drawable as I use it where a drawable is required.

Thanks!

// Erik
--~--~---------~--~----~------------~-------~--~----~



Text in of a custom drawable

by jefferyfry » Thu, 02 Apr 2009 08:24:03 GMT


 You will need to extend the View you are displaying the drawable and
override the draw method to add your custom text like this:

@Override
        public void draw(Canvas canvas) {
                super.draw(canvas);
                canvas.drawText("Title", x,
                                y, titlePaint);
        }



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Text in of a custom drawable

by Dianne Hackborn » Thu, 02 Apr 2009 09:31:22 GMT


 The drawable's draw() method takes a canvas, so there is no problem having a
drawable use that to draw text.

Also you should almost always implement View.onDraw(), not View.draw().







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

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.

--~--~---------~--~----~------------~-------~--~----~



Text in of a custom drawable

by guruk » Wed, 29 Apr 2009 00:30:39 GMT


 is there a chance to design new drawables dynamicly.

for example right now i have a calendar, each day does have a color
. now i like that its possible that each day does have a drawable
that includes three bars with different colors.

that mean i can create many drawables that fit all possible color
combinations, or i create a new drawable on the fly with the colors i
need

is that possible and how?

chris





--~--~---------~--~----~------------~-------~--~----~



Text in of a custom drawable

by Dianne Hackborn » Wed, 29 Apr 2009 00:56:22 GMT


 Subclass from Drawable, implement your drawing, instantiate it, and give it
to the view you want to have use it.








-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Properly Disconnecting the "Network" on the Emulator

Hi,
I'm working on making an app robust in the face of network
disconnection.

When I test a socket application on the emulator, and disconnect using
the Data setting on DDMS, the socket connection does not get cut.
Instead, it hangs.

Strangely enough, it seems that DDMS and logcat also get hung.

When testing on WiFi, and I disconnect using the Settings app, I get
an IOException immediately.

Any tips? Thanks.
--~--~---------~--~----~------------~-------~--~----~

2. where is the correct place to put libopencorehw?

2009/10/12 liang ming-chuan <lmc83...@gmail.com>:
[...]

Placing under directory hardware is better since it is meant by HAL.

Here is another sample:
    
http://gitorious.org/0xdroid/hardware_omap3_libopencorehw/trees/beagle-cupcake

It builds and works on TI OMAP3 platform.

Sincerely,
Jim Huang (jserv)
http://0xlab.org/

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Auto Text seperti di bb

4. should the values in R.java be unique?

5. R.java files

6. How to connect a context menu to a spinner popup?

7. Salam Kenal dan Nanya Prog Alkitab