android-drawable

Android make oval background drawable with chat corner

蹲街弑〆低调 提交于 2021-02-16 16:25:07
问题 I know how to create oval background, I add this drawable to a RelativeLayout background: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape> But I want to create this drawable and the corner of a chat like this: How can I add to this drawable the corner

Android make oval background drawable with chat corner

断了今生、忘了曾经 提交于 2021-02-16 16:24:34
问题 I know how to create oval background, I add this drawable to a RelativeLayout background: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape> But I want to create this drawable and the corner of a chat like this: How can I add to this drawable the corner

Android: make list item with background clickable

*爱你&永不变心* 提交于 2021-02-11 17:25:45
问题 I have a list where I have defined my own list view items with a custom layout. This layout has a background with a custom drawable. My custom layout for the ListView item: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/item" android:clickable="true" android:focusable="true" android:focusableInTouchMode="true" > ... </RelativeLayout> My custom drawable item.xml :

Android Drawable color runtime

旧城冷巷雨未停 提交于 2021-02-11 12:15:46
问题 I am developing an android app. I have two different text view with different text view as shown in below two images: Text view one: Text view Two: I have a question, should I create two different drawable files with different colors or should I create a single drawable file and change the color runtime? What's the standard way to achieve this? If I should create a single drawable file then how should I change to color programmatically? 回答1: try this simple example public class MainActivity

Images added to drawable folder not being recognized when the getFields() method is run

邮差的信 提交于 2021-02-10 08:48:26
问题 I have added 720 new images to my Drawable folder, but none of them are being recognized when I use Field[] drawables = android.R.drawable.class.getFields(); . Field[] drawables = android.R.drawable.class.getFields(); for (Field f : drawables) { try { System.out.println("R.drawable." + f.getName()); } catch (Exception e) { e.printStackTrace(); } } This just returns a list of the images added by default to the Drawable folder. I also tried getDeclaredFields but no success. 回答1: You need to use

Where to store images in Android

陌路散爱 提交于 2021-02-05 07:58:44
问题 I have moved all my images from the folder mipmap to drawable because here it was said that the mipmap folder is only for app icons to lanch the app Mipmaps vs. drawable folders (the answer got 841 likes). However, when I now want to start my app I get an error message FATAL EXCEPTION: main Process: com.example.td.barapp, PID: 4331 java.lang.RuntimeException: Canvas: trying to draw too large(188394348bytes) bitmap. at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260

Android custom vector scaling

不打扰是莪最后的温柔 提交于 2021-01-29 19:12:24
问题 I am attempting to create a custom shape to use as the background for my menu drawer. The issue i'm experiencing is that i can't get the shape i want. At the moment i am creating the shape as an svg in Adobe Illustrator and then converting that into an XML drawable but it isn't having the desired effect. How can i get the vector drawable to scale depending on its parent ( match_parent ) and content ( wrap_content )? menu_shape.xml An issue i've picked up on this is that this shape isn't

Found Drawable, Required 'int'. I am trying to load image in gravityView by Glide library

房东的猫 提交于 2021-01-29 14:58:56
问题 I am trying to load images from url with the help of glide library in gravityView. I searched many solutions and came up with this solution, but this code is giving me the error - Found Drawable, Required 'int'. public class gravity_view extends AppCompatActivity { public String imgurl; ImageView img; GravityView gravityView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.gravity_view); img = findViewById(R.id.bg); <-

How to get a Drawable that's a mirrored version of a different Drawable?

安稳与你 提交于 2021-01-27 04:32:38
问题 Background I know it's possible to create a rotated version of a Drawable (or Bitmap), as such (written about it here) : @JvmStatic fun getRotateDrawable(d: Drawable, angle: Int): Drawable { if (angle % 360 == 0) return d return object : LayerDrawable(arrayOf(d)) { override fun draw(canvas: Canvas) { canvas.save() canvas.rotate(angle.toFloat(), (d.bounds.width() / 2).toFloat(), (d.bounds.height() / 2).toFloat()) super.draw(canvas) canvas.restore() } } } The problem I wanted to have