Questions tagged [drawable]

1

votes
1

answer
1.4k

Views

How to set the blur level of a view background

To set the transparency level of a view background we use mView.getBackground().setAlpha(mViewTransparencyLvl); How to set the blur level of a view background? Knowing that the background is a shape drawable not an image. Knowing that the user controls the blur degree. Knowing that this view is over...
Jack
0

votes
0

answer
7

Views

How to animate an SVG verticle bar

I have the following SVG which I want to animate so that it would seem like it's moving up and down. This is how it should look like What I have tried I'm using Rich Path to animate the line with translationY which somehow does the job of from top to bottom but this library doesn't have reverse anim...
samirk433
1

votes
1

answer
34

Views

Stroke not getting applied to rectangle to xml drawable used as edittext backgroun in android

I have a corner rounded rectangle drawale in my app which I use as a background for edittext. When I try to add stroke to the rectangle it is not getting applied. Isn't it the correct way to do it?
Ankit Gaur
1

votes
0

answer
207

Views

Dynamically remove a layer from a layer-list

I would like to remove/hide a layer in a layer-list during runtime. How do I do this? I built a solution that works, but it feels a bit hackish. I replace the desired layer with a transparent image: LayerDrawable layerDrawable = (LayerDrawable) res.getDrawable(R.drawable.ic_layer); Drawable digit =...
Morgoth
1

votes
1

answer
58

Views

How can I access R (my package's R) to use Drwable image in Service

public class HelloService extends Service { ... .. NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Intent resultIntent = new Intent(HelloService.this,MapActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, resultIntent, Pend...
Pedro J
1

votes
3

answer
41

Views

Android layerlist drawable

I am creating a login layout for an app.For the background of the LinearLayout([email protected]+id/lgn_lyt) I tried to make it look like the image below.It looks fine in design editor,but in the device it look weird.The drawable I used is a vector image.Is it because of the vector image I used it coding mistake...
jobin
1

votes
2

answer
235

Views

SVG alter path without animation?

I have a battery icon I would like to 'animate' as in, change the length of the filling path to indicate battery percentage. However, android documentation for SVG's and SVG animation indicates you can only add predefined animations through xml. Is there a way to just simply alter the path of a SVG...
Rob van Dijk
1

votes
0

answer
109

Views

Triangle shape like an arrow in list for API < 23

I have been following the answer for this question Making a triangle shape using xml definitions?. I need to create a triangle that looks like arrow to be placed at the end of selected list item (see attached photos). I have managed to get it working by do the following: shape_diamond.xml ----------...
Sam
0

votes
0

answer
3

Views

set imageview tint color programmatically

hi i have problem with set tint color .. i want when choose color from color int Changes the color of the imageview with the same color i selected So when i click on color the imageview dont change the tint Noticeable: imageview use Drawable with default white color Noticeable: i don't want change D...
Ashraf Sharawy
1

votes
0

answer
62

Views

How to change the drawable of radio button to custom icon and recover?

I met the problem when I try to use radio button in RecyclerView. It`s easy to change the drawable to a custom one. But as we know that the view in the RecycerView is recycled, if I changed the drawable to a custom one, when it is used again it should show as the default drawable. Since the radio bu...
Shouheng Wang
1

votes
0

answer
59

Views

Is it necessary to have image resources for different screen density?

When I started learning Android, the course that I took mentioned about screen densities in a very early stage. And it encouraged me to generate image resources for HDPI, XDPI, XXDPI and XXXDPI. Whenever I get an image from designer, it is a XXDPI image and I will generate other versions using a plu...
Sira Lam
1

votes
1

answer
237

Views

Understanding Drawables and Images sizes

Firstly I did a lot of search to understand how it work, but I don't find simples tutorials. An exemple, this view: These are my drawables folders: The selected device is: Pixel 5.0 1080 x 1920 (xxhdpi). Immagine in this resolution (1080 x 1920) I set the image view on the top in blue color (Soluti...
Ben
1

votes
2

answer
293

Views

How to change drawable shape color based on spinner selection

I am trying to figure out how to change the solid color and the stroke color based on the spinner selection. spin_shape drawable Button with the drawable as a background Array resource xml file #ff0000 #e9b300 #db9fd5 #2988BC #660006 #0C6674 Here's what I used to change an image view based...
n.gause
1

votes
0

answer
63

Views

Custom RatingBar color bleed issue

I am facing a strange problem with my custom RatingBar drawable. My images of drawables are stretched as you can see in the image. I don't know what is the issue. I tried different solutions from here but none of them helped me. Here is my rating bar xml code here is drawable xml And these are 2 im...
KishanSolanki124
1

votes
1

answer
248

Views

Oreo: android.content.res.Resources$NotFoundException

my app seems to have a specific bug with some Android 8.0 devices on google play. Unfortunately, I haven't been able to replicate the bug myself so far. Here is the error log: android.content.res.Resources$NotFoundException: at android.content.res.ResourcesImpl.getValueForDensity (ResourcesImpl.jav...
AresProductions
1

votes
1

answer
74

Views

android drawables and animations not showing in released version

I am trying to animate circles (ShapeDrawables) on a View's canvas. The debug version of the app runs without issue. However, the released version does not show the circles or the animation. I have tried the following the following in Gradle apply plugin: 'com.android.application' android { config...
D. Beard
1

votes
1

answer
63

Views

Android: keep initial size of ImageView (src) into a responsive LinearLayout (without dp)

Context I'm looking to create a board game (like chess) on Android with a fullscreen responsive board compatible with any screen (landscape), using LinearLayout including match_parent, wrap_content and also a complex mix of weightSum and layout_weight for keep the same look regardless of the screen:...
Gaëtan Ribémont
1

votes
1

answer
27

Views

Change Colors States of Button using a Generic Drawable

I have Button that is using a custom drawable to make rounded corners. But I would like to change the background colors for the different states, focused, pressed etc.. I have used the below in onCreate to change the overall background color. But I don't know how to target the state_pressed to chang...
user-44651
1

votes
0

answer
125

Views

Android Drawable background randomly changes color to black or white

In our app we are experiencing some weird behaviour with the colour of one of our drawables. We're using it as a background to a button in many places in our code, the background drawable is only being set in the xml layout and we're not applying any tint or colour filter dynamically in Java. Seemin...
scudza
1

votes
0

answer
29

Views

Bitmap not adapting the changes when re-converted from BitmapDrawable

I have an array of 9 bitmaps split from a Bitmap. What I'm trying to do is changing the Bitmap arrayList to Drawable arrayList, applying porterDuffColorFilter to every Drawable of the array then converting them again to Bitmap. The colorFilter can be seen when I use setImageDrawable and use any of t...
Hardik sharma
1

votes
0

answer
28

Views

How to change a View size while animating in android?

I have the following set up inside a fragment in android studio: This animates from 100% to a received value. The circle is a ProgressBarHorizontal with this drawable: And the text, a TextView. Both Views are animated in this function: public void capacityRecieved(int value){ valueAnimator = ValueAn...
bleand
1

votes
0

answer
89

Views

Resizing images for different screen sizes

I need to display an image in an Android app. I have created images of given sizes: Density DPI Example Device Scale Pixels ldpi 120 Galaxy Y 0.75x 1dp = 37,5px mdpi 160 Galaxy Tab 1.0x 1dp = 50px hdpi 240 Galaxy S II 1.5x 1dp = 75px xhdpi 320 Nexus 4 2.0x 1dp = 10...
gariaable
1

votes
0

answer
31

Views

Android custom View: how to make Drawables survive rotation?

I am creating an Android custom View that allows the user to set a Drawable using both resource id and an instance of a Drawable itself. The problem is that after a configuration change (eg: change of orientation), the Activity is destroyed and recreated and, with it, also my custom View. For everyt...
Roberto Leinardi
1

votes
1

answer
251

Views

How to create a custom drawable pin with image marker

I'm trying to create a custom marker image identical to: I've created a layout with the background and the CircleImageView inside: /> Where ic_map_person_circle drawable is: And by code: Glide.with(mContext).load(imageUri) .placeholder(R.drawable.ic_default_user_image) .error(R.drawable.ic_default_u...
JackTurky
1

votes
0

answer
107

Views

How to change the values in drawable files?

I am developing an android App. I am using a drawable xml file to draw an arc. My Problem I want to change a particular attribute's value in the drawable xml file programmatically. I want to change android:dashWidth attributes value using java code. Steps Taken I searched stackoverflow , But there...
Lord Commander
1

votes
0

answer
1.5k

Views

error: too many padding sections on right border

when i build my project it give me error like I found the reason that, because of 9 patch file i am getting this error. so can any one please look at this 9-patch file for whats wrong in this below image. also i am using layer list for this drop down which is below drop_down_drawable.xml and this ab...
Prashant Jajal
1

votes
3

answer
70

Views

How to change background color programatically without afftecting border?

I would like to create a square with rounded corners and add a background color inside the shape and give it a border color like the following image: But i am only able to achieve this: I have a list of colors that need to be added for each of the rounded square boxes and its dynamic data so any num...
android6p
1

votes
0

answer
142

Views

Android drawable custom shape stroke multiple items

I have a custom shape I am trying to create to be the background of a tabview. This is the desired result: I am trying to create the background of the active tab with this step. I have the background as a different color so I can see what is doing what for now. This is what I have so far: But when...
Haring10
1

votes
0

answer
663

Views

Bottom navigation item menu custom background

I am trying to add a background as shown in the image, to the menu item in the android bottom navigation. I have used the following selector as item background (selector_bottom_nav.xml) And included in the bottom navigation like But I end up getting like this.
Abiranjan
1

votes
0

answer
51

Views

scaling and centering a path

I have a Path in Android and I want to stretch it to the full size of the canvas (screen size) and center it, i want to do this in my onDraw() event. The effect I'm going for is zooming in on the drawing until it matches the screen size. Btw, this is a View that is drawed on as the path is created f...
David Kachlon
1

votes
0

answer
15

Views

Android chart not working

I have been trying a lot to figure out why my chart is not generating. I have a class HomeExchange, with objects entered by user and then stored successfully in a List. I want to draw a pie chart to show the total number of objects that have the same value of the attribute 'nrCamere' with the gette...
Hatz Jon
1

votes
1

answer
278

Views

How to modify a drawable in a Resource File?

I'd like to modify already existing drawable objects in an external resource-file, like: Is it possible? Because Android Studio suggests me 'drawable' when I input an ''-file where I can also add style- and color- tags.
Michael Haas
1

votes
0

answer
20

Views

How to make reactangle which bends a little from top to bottom ? I mean top to bottom curve at the top

I don't want white color oval because it shows up in button background. I want this shape ane rest of the part transparent.
Yash Mehta
1

votes
0

answer
503

Views

Custom drawable speech bubble

I need to create a speech bubble background for an icons container like the white one in this image: Required Appearance I decided to use a drawable xml rather than a 9 patch image, so I can control of the rounded corner radii in my code. So, with the help of this answer to a related question, I hav...
1

votes
1

answer
41

Views

App crash on API 16 Phone when add drawable background on LinearLayout

When adding a drawable frame background in LinearLayout, the APP will crash on API 16 19 (Tested) but works on API 21 27. The LineayLayout is an item view in recyclerView and there is no animation for this background, it should work for all API level @color/colorGreen @color/colorGreen @color/colo...
Xianwei
1

votes
1

answer
40

Views

ShapeDrawable is not drawing properly when given as background

My Current view looks like this: I tried to draw a shape drawable with this code: and I managed to get this shape: ]2 The problem is that when I give this shape as a background of my layout, it looks like this: Where as my final goal is to make it look like this:
Damandroid
1

votes
3

answer
64

Views

Programatically created drawable not shown in imageview

I am trying to create a rectangle drawable inside an image view. val backgroundRect = GradientDrawable() backgroundRect.shape = GradientDrawable.RECTANGLE backgroundRect.setBounds(0,0, 100, 100) backgroundRect.setStroke(5, Color.parseColor('#585858')) backgroundRect.setColor(Color.parseColor('#FF900...
Rgfvfk Iff
1

votes
3

answer
166

Views

Android Drawable Horizontal Line

Is it possible to make line to be like this with xml? or there's some way to do that..? I already made some drawable with shape but it's not really like i want
Rizky Nofriwandi
1

votes
1

answer
46

Views

Android Irregular clickable buttons

My Problem is Overlapping Buttons (Only Transparent Region overlaps). Can we make only the visible part of an image/drawable Clickable? (Ignoring Transparent (alpha channel) of the button? (I am a designer, designing GUI)
rooney10057
1

votes
3

answer
542

Views

Status Bar Icon color does not change with Theme

In Notification, I used drawable xml as a setSmallIcon. When Status Bar background changes to white then my white icon disappears (actually background color and icon become same color). But if I use image icon as a setSmallIcon then status bar icon's color changes to grey. When Status Bar is white:...
tofa

View additional questions