drawable

Unable to scale Drawable with ScaleDrawable

情到浓时终转凉″ 提交于 2019-12-21 17:16:12
问题 Scaling with ScaleDrawable is not working for me. The drawable is remained in the same size. LayerDrawable layerDrawable = new LayerDrawable(layers); Drawable d = layerDrawable.getCurrent(); ScaleDrawable sd = new ScaleDrawable(d, 0, 0.01f, 0.01f); return sd.getDrawable(); What i need to do to fix it? Thanks. 回答1: You need to set the level: LayerDrawable layerDrawable = new LayerDrawable(layers); Drawable d = layerDrawable.getCurrent(); ScaleDrawable sd = new ScaleDrawable(d, 0, 0.01f, 0.01f)

Memory issues in fragments showing images

喜欢而已 提交于 2019-12-21 09:05:11
问题 I am using fragments to show images/pages.I have one Activity(Main) which contains all the fragments. package com.example.hscroll.demo; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.ListFragment; import android.support.v4.view.ViewPager; import

Drawable Resource Not Found

岁酱吖の 提交于 2019-12-21 08:22:50
问题 All I am attempting to implement a selector drawable resource for a custom ArrayAdapter . I am consistently getting a android.content.res.Resources$NotFoundException: File res/drawable/list_selector.xml from drawable resource ID #0x7f020 Could anyone offer suggestions? I have two xml files: res/drawable/list_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_checked="true" android:color="@android:color

Change button android:background to different drawable

被刻印的时光 ゝ 提交于 2019-12-21 07:09:08
问题 I am new to Android and Java but have managed to teach myself and find most answers to questions on stackoverflow without needing to ask questions. Until now.... Here goes, I have many colored buttons which, when clicked, change color to a range of different colors. There are many buttons defined for example as: <Button android:id="@+id/button17" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/orange_button" android

How to set status bar tint color in layout/style XML?

牧云@^-^@ 提交于 2019-12-21 06:25:19
问题 I'm using the windowTranslucentStatus in my app theme. Now, also want to tint the status bar to match my ActionBar. Currently I'm using the SystemBarTint library, which is mostly fine except of one problem: When the application launches, the OS shows a themed mockup layout as a splash image during the actual inflation. At that stage, there is no status bar tinting yet. It looks like that (Took me 5 times to capture this screenshot during app launch): Only after the activity is fully loaded

PackageManager.getApplicationIcon() returning default icon?

偶尔善良 提交于 2019-12-21 05:01:06
问题 Is there a way to tell if the Drawable I'm getting back from getApplicationIcon() is a default/built-in icon or not? For example, I have several applications installed on my emulator. "Adobe Reader" has an icon provided by Adobe. "com.android.gesture.builder" and "Sample Soft Keyboard", on the other hand, have a generic Android icon. getApplicationIcon() for those two packages returned different BitmapDrawable objects, but running getBitmap() on those two objects returned the same Bitmap

android xml drawable image on full screen background

与世无争的帅哥 提交于 2019-12-21 04:25:12
问题 I need an xml drawable (for a cordova splash screen) in android. I Want to display a transparent logo centered on the screen (without stretching), while the rest of the screen has a background color set. What I tried first, was to add only the image in the xml file: <?xml version="1.0" encoding="utf-8"?> <bitmap android:src="@drawable/splashscreen" android:gravity="center_horizontal|center_vertical" /> This showed the logo centered on the screen, but (obviously) has no background color. So I

Android : Rotate Vector Image to 90 degree

我是研究僧i 提交于 2019-12-21 03:53:32
问题 I have following code for my vector: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="314.015" android:viewportHeight="314.015"> <path android:fillColor="#FCD83500" android:pathData="M157.007,0C70.291,0 0,70.289 0,157.007c0,86.712 70.29,157.007 157.007,157.007c86.709,0 157.007,-70.295 157.007,-157.007C314.014,70.289 243.716,0 157.007,0zM31.403,157.015c0,-69.373 56.228,-125.613 125.604,-125.613V282.62C87.631

Android - Best way to overlay a play button on an image/thumbnail

强颜欢笑 提交于 2019-12-20 14:12:12
问题 I have an android application which can playback audio/video and show pictures. For videos I want to overlay a play button on top of the preview image and also in list views.. Right now how I'm doing it is with an ImageView in xml, and then the drawable is a layer layer-list which I define programmatically because one of the images is dynamic, the play button is static of course. I want to align the play button 10px from the bottom, and centered horizontally. My ImageView is defined like this

Create a custom Drawable and use it in XML

限于喜欢 提交于 2019-12-20 11:31:54
问题 I am busy creating a less complicated version of NinePatchDrawable that tiles the inner panels instead of stretching them. I can implement the actual logic to do the rendering and such. However, I can't find documentation about how to use this Drawable in the XML files. Is this possible? That is, can I have a <tileable-nine-patch> , or some such, tag I can use to define resources? 回答1: Unfortunately it is not possible to use custom drawables in XML files (for API 23 and below) due to