drawable

How to protect drawable resource in Android application

荒凉一梦 提交于 2019-12-06 02:40:55
问题 Please tell me how to protect our resource in a apk package. With a simple rename-extract process, any one can copy and thief application drawable resource like images or soundFX files. My question is, is there any way to protect drawable resource in a Android application? 回答1: The drawable needs to be accessible to the operating system, so it has to be readable. If you really want to keep it secure, you could consider storing it encrypted as a raw asset, then load it, decrypt it into a

Drawable from mdpi loading instead of hdpi

我是研究僧i 提交于 2019-12-06 01:37:51
I have set up my project with different drawable directories (ldpi, mdpi and hdpi). I have a background png with two different resolutions: 320x480 in drawable-mdpi folder, and 480x800 in drawable-hdpi. Both have the same filename. When I try to load the background as a style in the manifest (using android:windowBackground in the style) if I use the emulator for a 1.6 device, I get the correct one loaded(mdpi). However, if I try this on my Nexus, I see that at first the correct background from the hdpi folder is loaded, but it quickly switches to the mdpi one. I have tried also to set up the

Android: How to move a BitmapDrawable?

☆樱花仙子☆ 提交于 2019-12-06 01:35:28
问题 I'm trying to move a BitmapDrawable in a custom view. It works fine with a ShapeDrawable as follows: public class MyView extends View { private Drawable image; public MyView() { image = new ShapeDrawable(new RectShape()); image.setBounds(0, 0, 100, 100); ((ShapeDrawable) image).getPaint().setColor(Color.BLACK); } @Override protected void onDraw(Canvas canvas) { image.draw(canvas); } public void move(int x, int y) { Rect bounds = image.getBounds(); bounds.left += x; bounds.right += x; bounds

Android LayerDrawable.setDrawableByLayerId not working on HTC Sensation (and others?)

Deadly 提交于 2019-12-06 00:20:37
I am using LayerDrawable to build up a series of hotspots (indexes 1+) on an underlying image(index 0). The hotspots are added based on user interface interaction, and their position is dynamic, so I'm doing all of this programatically rather than using XML. As a further (probably irrelevant) detail, I am using a Fragment to hold the LayerDrawable, as this is in the contexts of an FragmentStatePagerAdapter and ViewPager. The problem is that when I try to update an image by changing the Drawable in the LayerDrawable by called setDrawableByLayerId, the image does not change (despite the method

Share image with Android intent

不问归期 提交于 2019-12-06 00:16:59
I'm trying to share an image trough a share intent like this: Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType("image/png"); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, application.getString(R.string.app_name)); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,application.getString(R.string.app_share_message)); File image = new File(Uri.parse("android.resource://" + C.PROJECT_PATH + "/drawable/" + R.drawable.icon_to_share).toString()); sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(image)); shareMe(sharingIntent);

Set size of Layered Drawable?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 23:41:22
问题 I am making a icon for my app.. The app is basically a friend finder. I am creating a overlay that looks much like the icons from Google Latitude. I have an image that changes due to the user and I have the boarder. I've been able to do the layered drawable and overlay fine, but the problem is, the image stretches to the size of the border. This is a problem because, if you've never seen the Google Lat icons, it has a point on the bottom with open space between it. What I need to do is,

Android radial gradient

我们两清 提交于 2019-12-05 23:34:02
问题 I've got following drawable set as LinearLayout background: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <bitmap android:tileMode="repeat" android:dither="true" android:src="@drawable/bg"/> </item> <item> <shape android:shape="rectangle"> <gradient android:startColor="#ffff0000" android:endColor="#ff00ff00" android:centerX="50%" android:centerY="50%" android:gradientRadius="50%" android:type="radial"/> </shape> </item> <

calling setCompoundDrawablesWithIntrinsicBounds on multiple views with the same background gives inconsistent sizes

拟墨画扇 提交于 2019-12-05 23:15:21
I've got a LinearLayout with two EditText descendants (not direct children). I call EditText.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.xyz,0) on each to put a drawable (the same drawable) on the right side of each of the EditText s. The two edit texts are identical, except for their order in the ListView . However, the size of the drawable in the first EditText becomes larger than the second after adding the drawables. Specifically, the first EditText resizes to accomodate the intrinsic size of the drawable, whereas the second EditText does not (although it does grow some small

LibGDX - How to smooth out actor drawable when scaling a Scene2d stage?

最后都变了- 提交于 2019-12-05 22:57:34
问题 This is my set-up: stage = new Stage(1280, 800, false); button = new Button(drawableUp, drawableDown); stage.add(button); this gets rendered as following: @Override public void render(float delta) { Gdx.gl.glClearColor(RED,GREEN,BLUE,ALPHA); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(delta); stage.draw(); } The issue is that when the stage is shown on 1280x800 the button looks like that: If the stage is rescaled to e.g. 1280x736, the button drawable is scaled in the following way: Is

Android - Multiple colors & size in drawable shape style

为君一笑 提交于 2019-12-05 22:39:36
I'm trying to have a circle background for my TextView, so I created a shape style as below. But I need to have multiple colors with multiple sizes (while the textSize stays constant), so I need to set the width/height in the style. From my understanding.. Layer List puts all the shapes on top of one another? Because I need to call it 12 times at different places, so it seems quite cumbersome to have 12 shape style xmls. Is there a better way to have all the different shape/size combinations inside one XML? Shape Style: <shape xmlns:android="http://schemas.android.com/apk/res/android" android