Drawing image with dynamic text

by Neilz » Wed, 09 Dec 2009 19:50:20 GMT


Sponsored Links
 Hi all.

I understand the principle of a 9Patch image where the image stretches
to fit the text within it. But this all assumes that the image is a
background to a TextView, or similar.

What I want to do is draw an image to the canvas, and set the
contained text at the time (currently I'm using canvas.drawText) - but
here the image has no connection with the text, or with a view, so it
wouldn't know to stretch.

I know this can be done, I've seen it, I'm just not sure how to go
about it... it's a bit like on google maps where you have a marker
with a cloud image containing the info, it is set dynamically. Any
ideas appreciated!

--



Other Threads

1. How to upgrade the ant build.xml file from 1.1 project to 1.5

> I followed the instruction in 1.5 SDK upgrading at link

The tasks that Android supplies are now held in Ant plugins, so you will
not see them in the build.xml file itself. If you created your own Ant
tasks, you will need to copy those over.


That would depend, I suppose, on what those tasks did.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html



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

2. Widget and views

Hi,

I have already developed some widgets for android, but every time, I
have the same problem... I Can' access my XML layout's elements from
my java code.

For example :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TextView
                android:id="@+id/myTxt"
                android:Text="HelloWorld !"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

</LinearLayout>

With this layout, how can I access my "myTxt" object ?

Thank you for your help

ColletJb

PS : In an Activity, the equivalent is "findViewById(int)".


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

3. fit text on 1 line

4. Can i test barcode scanning task on emulator ??

5. Alphanumeric Input in an EditText View (how to use "digits")

6. transparent application

7. Default Styles?