Is there a way to apply a 'resize' animation as opposed to a scale animation in Android? When using the scale animation, the image or layout being resized is stretched out, this includes the border / stroke outline that is outlines the image. I have a box, with 2 lines around them, when the animation is applied the stroke appears to gr...
I'm using the follow code, to create a non-scaled, centred image as a background, in a relative layout:-
RelativeLayout explosionlayout = (RelativeLayout) findViewById (R.id.explosionlayout);
explosionlayout.setBackgroundColor(R.color.white);
Bitmap myBitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.bomb);
Bitm...
Is there a way to define a 9 patch drawable in an android xml file? The reason I ask, is that when you apply a scale animation to a drawable w/ a stroke on it, the stroke appears to thicken. I'd like to make the stroke stay the same size as the animation plays...
...
What is the best approach when using default Android drawables? Should I use android.R.drawable or should I copy the drawables in my project and use R.drawable?
Is there any risk, that in a newer version of Android, some of the default drawables are removed or resized? Or, affect in some negative way, the look of my app? Also, which of ...
Hi all!
I have a basic LinerLayout with a TextView and an ImageView
I would like to do the same thing as with a button: when you click on this linear layout, the background changes. I can change the background when I focus the LinearLayout (with the trackball), but I can't when I click on it! And I don't know why.
I tried a lot of thin...
In my Android project, I want to loop through the entire collection of Drawable resources. Normally, you can only retrieve a specific resource via its ID using something like:
InputStream is = Resources.getSystem().openRawResource(resourceId)
However, I want to get all Drawable resources where I won't know their ID's beforehand. Is ...
Is there a way to encode a string as a bitmap? Or a drawable?
Thanks
Chris
...
I'm creating a gallery view where I'm loading images from the web. While the images are loading, I want to display an animation as a placeholder for each image. I figured this could be done using an AnimationDrawable, however, the animation won't start. The first frame of the animation loads as expected, and if I use the same in for exam...
Hey guys. I'm newer in android development. And after using eclipse about 1 month... i hate this. I've setup NetBeans IDE for android development. It's fast, it's looks like cool and i like it. But have one trouble. I cant find how to use drawable resources (just like R.drawable.icon) :( . Can anyone help me?
PS: sry 4 my english )))))...
I defined a drawable
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http//schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffffff" />
<size android:width="60dp"
android:height="40dp" />
</shape>
But how to use it in the layout definition?
<?xml version="1.0" enc...
Where should I start an AnimationDrawable that needs to animate when the activity is shown?
The developer guide recommends using onWindowFocusChanged, but this isn't always called when the activity is part of a TabHost.
I quote:
It's important to note that the
start() method called on the
AnimationDrawable cannot be called
d...
I would like to add an HTML resource to my Android project with references to other resources (mainly drawables).
Where should I put it and how do I reference other resources from it?
Is there a particular way to pass the HTML resource to a WebView?
Thanks!
...
Hello,
Below is My code to create a shortcut to a selected application. I have really no problem and the application work quite well.
The problem is that I am able to create a shortcut with a ressource from my application:
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(this, R.drawable...
is there a way to have 2 gradients in a drawable xml using either a <layer-list> or <shape> or some combination of them?
...
Looking at the following image, the button on the left is android 2.1, the one on the right is 2.2:
As you can see the corners on the left image are not being applied correctly, but they look perfect in 2.2. The xml I'm using is here:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="0di...
What I mean by this is, if I have several drawables in different areas of the screen, how can I use a callback on that drawable to detect when a gesture is drawn by the user directly over one of them so that it is specific to that drawable and not all drawables on the screen at that time?
Thanks
...
Greetings:
I am writing an Android app that includes an ImageView. The image to be included in the view resides on the local app directory of the emulator. The image is not being displayed in the view. The relavent XML and method used to display the image are given below.
The image file is a "png" format file and is able to be opene...
I am presently using the following peice of code to load in images as drawable objects form a URL.
Drawable drawable_from_url(String url, String src_name) throws java.net.MalformedURLException, java.io.IOException {
return Drawable.createFromStream(((java.io.InputStream)new java.net.URL(url).getContent()), src_name);
}
Th...
I am trying to open a Resource by passing the result of context.getResources().getString(R.drawable.myimage) to another class that is not an activity. context.getResources().getString(R.drawable.myimage) returns res/drawable-mdpi/myimage.png However, when I try and open this file, it throws a FileNotFoundException.
What is the proper ...
I have a free android app that I want to now distribute as free (with ads) and paid (without ads), so the only difference would be in a few of the layout files, where I just remove the ads in the paid version.
I tried moving all of my code from my existing free app to a new project which I set up as a library project, and I'm referencin...