Scale a background image or drawable?

by Sam » Thu, 10 Sep 2009 00:47:40 GMT


Sponsored Links
 Hi,

On a layout I want to scale the background image (keeping it's aspect
ratio) to the space allocated when the page gets created. Anyone have
any idea how to do this?

I am using layout.setBackgroundDrawable() and am using a
BitmapDrawable to setGravity for clipping and filling, but don't see
any option for scaling.

Sam
--~--~---------~--~----~------------~-------~--~----~



Scale a background image or drawable?

by Sam » Fri, 25 Sep 2009 10:37:45 GMT


 Thanks! It worked great with some tweaking for what I needed.





> Drawable:


Sponsored Links


Scale a background image or drawable?

by Sam » Fri, 25 Sep 2009 10:38:01 GMT


 Thanks! It worked great for what I needed to do.





> Drawable:



Other Threads

1. Android Functional Testing (testing multiple activities)

So I've learned a bit more about the Instrumentation, but now I am at a
point where it HANGS if I have more than one test case running.

I'm running a cross-activity functional test case using
InstrumentationTestCase.

I have to run handles for the ActivityGroup, currentActivity, and the
activityManager.
I also instantiate an activity monitor so I know when to wait for other
activities to finish executing.

The problem now is, I run more than one test, and the instrumentation test
runner hangs on the second test case in the stack.


Anyone!?







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

2. How to finalize cursor

I am getting following exception :

Ljava/lang/IllegalStateException;: Finalizing cursor
android.database.sqlite.sqlitecur...@433d8320 on usage_count that has
not been deactivated or closed

and when I am using


if (!cursor.isClosed()) {
                                cursor.deactivate();
                                cursor.close();
                        }

in finally block then it will start giving NullPointerException.

I will appreciate the help.

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

3. Intent filter for mimetype doesn't modify browser HTTP accept header

4. C to CPP conversion (or vice-versa) based on the package type having C or CPP.

5. WebView and Button in layout, only one of them can be clicked.

6. How to make UI calls from a separate thread

7. Opencore version in Donut