Questions tagged [drawable]

A Drawable is a graphics-related term which generally means "something to be drawn."

Filter by
Sorted by
Tagged with
0 votes
2 answers
70 views

How to change image dynamically in drawable folder in Android studio?

I have this snippet below: public void onReceive(Context context, Intent intent) { try { int random_int = (int)Math.floor(Math.random() * (max - ...
user3063697's user avatar
1 vote
1 answer
53 views

android drawable border remove bottom line

Here is border xml And I want to remove bottom, how to achieve it? <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <...
GHH's user avatar
  • 1,797
0 votes
0 answers
70 views

Convert SVG to drawable/canvas for GraphicsView in .NET MAUI app

Is there a way to convert SVG vector files, or any vector illustration format, into actual drawables for a GraphicsView in my .NET MAUI application? This is an example of the code I'd like to end up ...
DPC's user avatar
  • 657
0 votes
0 answers
19 views

PNG image is deleted from drawable file but is still giving an error

I was trying to run an android studio app but it gave an error for a particular .png image in the drawable folder which said that the file must end with .xml Even after replacing the image with a .xml ...
rhucha's user avatar
  • 1
0 votes
0 answers
6 views

Set background to gradient animation drawable not work

This is my first post. Please dont shoot me. LOL I successfully write code for gradient AnimationDrawable in one of activity. But when I try to implement the code in Theme Activity, it say :- enter ...
Humble's user avatar
  • 1
0 votes
0 answers
23 views

Button drawable background

I want to change the button background using a drawable. The problem I have is that the button did not chang properly. Gradient button.xml: <?xml version="1.0" encoding="utf-8"?&...
user avatar
0 votes
1 answer
19 views

Some phones incorrectly setIcon to submenu

I have some phones android <= 9 which applies last color for all list items in submenu. How to fix this? .subscribe(labels -> labels.forEach(label -> { Drawable drawable = ...
Slava's user avatar
  • 475
0 votes
2 answers
72 views

Xamarin.Android Switch -Set colors of thumb and track drawables

I have a switch with custom track and thumb. <Switch android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/...
Gith's user avatar
  • 13
1 vote
1 answer
34 views

Changing color of android:drawable according to light mode or darkMode

I have created a splash screen for React Native using native Android, without any additional libraries (which is my purpose) How can I switch the color from the splash screen according to the device ...
Nilton Schumacher F's user avatar
0 votes
1 answer
26 views

How to get the true colors of an android:icon to show through in a Button

I'm using this code: <Button android:id="@+id/play_pause_button" android:layout_width="match_parent" android:...
Ben the Coder's user avatar
0 votes
0 answers
25 views

Android Studio cannot resolve symbols

At first i had to rename the .png file names because they were not acceptable. Now that i have renamed them and change the name on the code i still get an error that my drawable 'd6' etc cannot be ...
Italia's user avatar
  • 11
1 vote
1 answer
166 views

System.TypeLoadException when running Maui.Graphics Live on Android

I was running the app on Android fine until I added the curve functionality where I am using Microsoft.Maui.Graphics **IDrawable **with GraphicsView . When I build the app on android I get this error ...
mesut's user avatar
  • 27
0 votes
1 answer
22 views

Drawing the Drawable of icon of an app doesn't works

I'm creating a launcher app on Android, and I get the icon of an app by calling mResolveInfo.activityInfo.loadIcon(mPackageManager). The problem is that when I'm trying to draw this drawable on canvas ...
user avatar
0 votes
0 answers
11 views

Android canvas drawing undo/redo not working with background image

Canvas drwing success but can't undo or redo this drawing. i want to pin over the background image. it will be single pin draw or multiple pin or user can draw line. please helping for adding undo/...
AK IJ's user avatar
  • 522
0 votes
0 answers
31 views

React Native Integration Exception: android.graphics.drawable.Drawable$ConstantState on a null object reference

When I want to do RN integration with existing app, I encountered a npe problem that drawable object is null. The stack info is attached below. The problem seems made by TextInput component. Now, I do ...
Lucas's user avatar
  • 1
0 votes
0 answers
27 views

How to draw this Form as a Shape(XML-Drawable) in Android Studio

How can i draw or create this navigation background as a shape in Android Studio. To draw a rectangle is not the problem. Instead of this i need an idea for drawing the inner oval (transparent). I ...
Yafes The Programmer's user avatar
0 votes
2 answers
119 views

I am having a hard time adding shadows in Android (in general)

In this example, I have a bottomSheet with a fragmentContainer inside it. And my bottomSheet has a radius on the bottom corners. My solution was to add a gradient view to simulate the shadow, but it ...
Hugo Oliveira's user avatar
0 votes
2 answers
42 views

How do I change the background of an element to a different drawable?

I want to make a textView that turns green with a positive number, red with a negative number, and goes invisible when 0. I have two separate drawables for each background. I have changed updateView....
Speedy's user avatar
  • 23
0 votes
1 answer
173 views

How to insert text in the backgroung of a View in Android Studio and Java

In Android Studio I need to insert text in a drawable, to use it as a background of a TextView. In Android Studio I inserted, as a background, a rectangle around a TextView, as shown in the first ...
SnoopyG's user avatar
1 vote
1 answer
39 views

How to Implement a GradientDrawable object in Main Activity

I trying to create a traffic application. its very simple just a label and button. I wanted the label to be in a circle shape rather than square so I implemented the following in the main activity: ...
Aimex's user avatar
  • 51
1 vote
1 answer
66 views

How can I have an ImageView beside a multiline TextView and don't exceed the limit of parent?

I am trying to align an ImageView besides to a TextView, but I am having troubles getting the expected result. The TextView can have more than one line, therefore I am using android:layout_width="...
xerez's user avatar
  • 37
0 votes
2 answers
430 views

How to create a drawable xml from this PNG image?

I have this PNG image above (which I exported from Figma). How do I recreate it using drawable xml? I want to try using layer-list but I'm not sure how to do it. I need to use drawable because I need ...
squall leonhart's user avatar
0 votes
0 answers
37 views

Android studio automatically generating .png file during build time

I have an Android app. Few months back I added a .png drawable inside it. Now I have removed it from the app and it's uses as well. I deleted all instances of it from the root folder. The problem is ...
oyeraghib's user avatar
  • 956
0 votes
0 answers
48 views

Android: How to draw vector drawables?

Is there a tutorial on creating vector drawables? I have no idea how the math behind paths, vectors, groups etc works, nor even understand what the values mean. Is there a graph? Is there a tool that ...
Regress.arg's user avatar
0 votes
1 answer
128 views

Android Drawable wrapper so that that I can change the drawable in all views by replacing in wrapper

Is there a class like Drawable Wrapper? The use case is as follows. I have a layout where many views have background set to a Drawable object. Now I want to replace this Drawable with new one in all ...
cubesoft's user avatar
  • 3,498
0 votes
0 answers
99 views

How to rotate Drawable with animated vector?

I have a vector drawable: <vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" android:width="34dp" ...
Nickaleush's user avatar
0 votes
1 answer
72 views

Why can I not use a while loop to draw a chessboard on my desktop, but can on my laptop?

I'm trying to make a chess board using a while loop. However when I use a while loop, the tiles show up for a second and then they disappear. The code for the panel package chess; import java.awt....
NotQuiteSoInvisible's user avatar
1 vote
1 answer
36 views

how to find out program made drawable resource id (drawable object to int resource id)

I am making drawable resource using following reference https://developer.android.com/develop/ui/views/graphics/drawables#java MyDrawable mydrawing = new MyDrawable(myText); ImageView image = ...
Woncherl Ha's user avatar
0 votes
0 answers
24 views

Drawables used for menus deleted in release build

I am trying to figure out how to make a release build. I followed guides from dev, but unable to keep drawables in my projects that are used for menus Even when checking shrinkResources as false in ...
SirBzik's user avatar
0 votes
1 answer
537 views

Is an "animation-list" drawable supported in Jetpack Compose?

I am converting a layout android app to compose. I have encountered an issue using an "animated-list" from my drawable resources, and I am guessing that this format is just not supported ...
80sTron's user avatar
  • 99
0 votes
2 answers
81 views

How to alight drawable left near to TextView Android (Or custom snackbar android)

I'm using a custom SnackBar for android, I have created SnackBar with an icon and a message. Icon drawable isn't working as expected. The margin text is further than expected. So, this is what I did: ...
Nguyễn Kim Khánh's user avatar
0 votes
1 answer
168 views

How to transform uri to integer for drawable?

I am working on widgets and i need to use this views.setImageViewResource method in AppWidgetProvider but this method wants integer but i have uri how can i solve this problem? class ...
Kisbet's user avatar
  • 3
2 votes
0 answers
273 views

How to get drawable with hexadecimal ID in android studio

I got a Resource Not Found exception, but I do not know which drawable causes. Because, the app is in publish and I saw this error on Firebase crashlytics. This is run time error and this crash occurs ...
Begmyrat Mammedov's user avatar
0 votes
0 answers
30 views

@drawables causing lag in Layout

I did CPU profiling and found that my drawable in the XML layout is the main reason for the lag. My before removing drawable and after removing drawable CPU profiling screenshot below: BEFORE: AFTER: ...
coderror's user avatar
0 votes
0 answers
51 views

can't consider radius of different angles in imageview

I'm facing a problem with the background in imageview. I have 2 drawable shapes as follows: type_1 is: <?xml version="1.0" encoding="utf-8"?> <shape android:shape=&...
Văn Mạnh Trịnh's user avatar
0 votes
1 answer
81 views

How to add a Drawable object to a Parcelable object when I save the state of a custom view?

I am creating a custom view in android application. Custom view has Drawable object that is a vector image and is stored in folder res/drawable/ I want to save its state, so I create class SavedState ...
sh_nadegda's user avatar
0 votes
1 answer
617 views

how to make a custom drawable using xml in android studio for layout background

I want to draw this set following the background in my layout but I am not able to do this in XML if anyone expert in this please help me with this task thank you in advance for helping
Muhammad Hamza's user avatar
-1 votes
1 answer
34 views

how to drawText transparent with background Path in Canvas Drawable?

how to drawText transparent with background Path in Canvas Drawable? https://i.stack.imgur.com/RkS41.jpg
user20269297's user avatar
0 votes
1 answer
43 views

Kotlin Emulator does not run app when as use a png image as drawable

I'm using Android Studio Dolphin | 2021.3.1 and Pixel 5 API emulator. The following code is used to show image in a button. But when I use calc.png emulator says launch is successful but quit from ...
Hope's user avatar
  • 2,116
0 votes
1 answer
115 views

What actually happens in this code? I use the Python Turtle library to draw the fireworks, and I try to use random RGB color

import turtle import random t = turtle.Turtle() w = turtle.Turtle() t.speed(0) w.speed(0) w.penup() t.penup() def randcolor(): col1 = random.randint(0,255) col2 = random.randint(0,255) ...
Bill Truong's user avatar
0 votes
0 answers
196 views

setColorFilter(int,Mode) is deprecated

I have been using this method: public void setColorFilter (int color, PorterDuff.Mode mode) but I have seen that it is deprecated. In the Android documentation I have seen that I can use this instead: ...
Lechius's user avatar
  • 175
1 vote
1 answer
435 views

How to access size of Android Drawable

I have the following drawable, called small: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:...
user1332148's user avatar
  • 1,266
0 votes
2 answers
382 views

How to create shapes on drawable layout android

I need to create a layout that will be with rounded corners, but in which there will be various shapes. I have a sample (in the screenshot below). I created a layout with rounded corners and the right ...
onesector's user avatar
  • 361
0 votes
1 answer
205 views

Android drawable turns black and white when changed programatically

I have a Floating action button that has a drawable as a source looking like this (the chef button) - Later on in my app I change it's source programatically to another source, and then back to the ...
Nadav Holtzman's user avatar
0 votes
0 answers
50 views

How to erace (delete) the filled cairo shape?

I want to paint a rectangle to select the area according to mouse coordinates. So, the rectangle should be created and deleted every frame (the if statement below executes every frame). I was trying ...
XoDefender's user avatar
0 votes
1 answer
419 views

The button's background is displayed in the blue color for Android

Dear stackoverflow members, have a good day. Actually, I want to apply my xml drawable file on a button, so I have used the attribute background to change it to the designated xml file, but the button ...
TesterQA___2000's user avatar
2 votes
1 answer
318 views

How to resize drawable in a TextInputEdit

I have a TextInputEditText field to write numbers down. I want to add a drawable symbol to the end of my InputText which already worked. The problem is, that my text and the drawable are not the same ...
Sasuke's user avatar
  • 33
1 vote
1 answer
208 views

Set border for view with an icon in the corner

I would like to add a border to view which to have an icon in the corner like this: I write a drawable with border: <shape xmlns:android="http://schemas.android.com/apk/res/android" ...
Saeid Honardan's user avatar
0 votes
0 answers
63 views

Android drawable menu options are not clickable

I want to create a drawable menu for my android app, currently using Java. I followed this tutorial: https://www.geeksforgeeks.org/navigation-drawer-in-android/ Mainactivity.java ... public ...
Alex T's user avatar
  • 43
4 votes
1 answer
1k views

How to test Drawable in Jetpack Compose

I have a Box inside which I am adding image with drawable content. How can I write UI test for checking drawable is visible or not?
Akshay Nandwana's user avatar

1
2 3 4 5
60