drawable

How to get the rectangle of the Drawable of ImageView on Android?

有些话、适合烂在心里 提交于 2020-07-05 09:10:29
问题 I want to get the rectangle object that will wrap the Drawable of ImageView instead of the rectangle that will wrap the ImageView. I will use that rectangle to draw some fancy rectangle around Drawable. How can I get that rectangle? 回答1: Rect rect = new Rect(); ImageView iV = new ImageView(); rect.left = iV.getLeft(); rect.top = iV.getTop(); rect.bottom = iV.getBottom(); rect.right = iV.getRight(); Now you have your rectangle. 回答2: You can use getImageMatrix() See: Android how to get bounds

How to get the rectangle of the Drawable of ImageView on Android?

做~自己de王妃 提交于 2020-07-05 09:08:33
问题 I want to get the rectangle object that will wrap the Drawable of ImageView instead of the rectangle that will wrap the ImageView. I will use that rectangle to draw some fancy rectangle around Drawable. How can I get that rectangle? 回答1: Rect rect = new Rect(); ImageView iV = new ImageView(); rect.left = iV.getLeft(); rect.top = iV.getTop(); rect.bottom = iV.getBottom(); rect.right = iV.getRight(); Now you have your rectangle. 回答2: You can use getImageMatrix() See: Android how to get bounds

android get Drawable image after picasso loaded

我怕爱的太早我们不能终老 提交于 2020-06-24 08:19:20
问题 I am using Picasso library to load image from url. The code I used is below. Picasso.with(getContext()).load(url).placeholder(R.drawable.placeholder) .error(R.drawable.placeholder).into(imageView); What I wanna do is to get the image that loaded from url. I used Drawable image = imageView.getDrawable(); However, this will always return placeholder image instead of the image load from url. Do you guys have any idea? How should I access the drawable image that it's just loaded from url. Thanks

Sweep Gradient : What it is and its examples

一曲冷凌霜 提交于 2020-04-07 14:02:55
问题 I came across Sweep Gradient on Android and was intrigued if it could give me a better control over the Color spacing and transitions. Did a quick search and found almost nothing about it!! The only few references I found (and they do not meet the criteria of coming even close to explaining it properly or comprehensively) are listed below : Sweep Gradient on Android (which only mentions commands to use - which is of almost no worth since right now I have no clue what Sweep Gradient is!)

BitmapDrawable deprecated alternative

若如初见. 提交于 2020-03-08 04:59:00
问题 I have the following code that will rotate a drawable by a set amount of degrees. public Drawable rotateDrawable(float angle, Context context) { Bitmap arrowBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.generic2rb); // Create blank bitmap of equal size Bitmap canvasBitmap = arrowBitmap.copy(Bitmap.Config.ARGB_8888, true); canvasBitmap.eraseColor(0x00000000); // Create canvas Canvas canvas = new Canvas(canvasBitmap); // Create rotation matrix Matrix rotateMatrix =

BitmapDrawable deprecated alternative

旧时模样 提交于 2020-03-08 04:58:36
问题 I have the following code that will rotate a drawable by a set amount of degrees. public Drawable rotateDrawable(float angle, Context context) { Bitmap arrowBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.generic2rb); // Create blank bitmap of equal size Bitmap canvasBitmap = arrowBitmap.copy(Bitmap.Config.ARGB_8888, true); canvasBitmap.eraseColor(0x00000000); // Create canvas Canvas canvas = new Canvas(canvasBitmap); // Create rotation matrix Matrix rotateMatrix =

MVVMCross Native Android Progressbar move element with the current progress

元气小坏坏 提交于 2020-03-03 05:33:04
问题 I have a progressbar as shown in the following image. My problem is that I want to move the TextView that shows the current step of the progress, along with the progress. So in the step 3/7 it should move with the progress. The inside drawable is a styled xml shape drawable. rounded_corners_progress_bar <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="8dp"/

MVVMCross Native Android Progressbar move element with the current progress

微笑、不失礼 提交于 2020-03-03 05:32:31
问题 I have a progressbar as shown in the following image. My problem is that I want to move the TextView that shows the current step of the progress, along with the progress. So in the step 3/7 it should move with the progress. The inside drawable is a styled xml shape drawable. rounded_corners_progress_bar <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="8dp"/

Why does Android Drawable Importer ignore selection in AS 3.5 onwards

℡╲_俬逩灬. 提交于 2020-02-26 03:42:38
问题 After right-click --> new Batch Drawable Import and selecting any .png from the Select Image Asset(s) box, the primary Batch Drawable Importer box remains empty (ie: the selection was ignored!). First 2 lines of Event Log: java.lang.NoSuchMethodError: org.jetbrains.android.facet.AndroidFacet.getAllResourceDirectories()Ljava/util/List; at de.mprengemann.intellij.plugin.androidicons.util.AndroidFacetUtils.getResourcesRoot(AndroidFacetUtils.java:48) So apparently Android Drawable Importer is

android - setBackground with checking android version not working

家住魔仙堡 提交于 2020-02-23 06:44:33
问题 I want change the background drawable of a button. My min. SDK version is 14. Therefore I check the current version, which is installed on the device: int sdk = android.os.Build.VERSION.SDK_INT; if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { buttonClubPublic.setBackgroundDrawable(buttonClubPublic.getContext().getResources().getDrawable(R.drawable.check_button)); buttonClubPrivate.setBackgroundDrawable(buttonClubPrivate.getContext().getResources().getDrawable(R.drawable.uncheck_button))