drawable

get drawable exactly the size of the imageView to use as a placeholder

随声附和 提交于 2019-12-08 12:42:01
问题 I am using Universal Image View to load images into my application. This is the method I implemented public static void setBitmapToAImageviewUIL(final ImageView imageView, String uriPath, String imageName) { if(imageName != null && !imageName.equals("")) { //We use the local image as a temporary placeholder DisplayImageOptions options = new DisplayImageOptions.Builder() .showStubImage(Utilities.getDrawableResource(imageName)) .cacheOnDisc() .cacheInMemory() .imageScaleType(ImageScaleType

Android BitMapDescriptor from XML shape transparent is black

狂风中的少年 提交于 2019-12-08 12:17:59
问题 So this bitmapdescriptor when used in a Groundoverlay on GoogleMap (v2) the transparency is being shown as black can anyone explain why? Radius Circle shape file <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <gradient android:startColor="@color/brand_color" android:endColor="@android:color/transparent" android:type="radial" android:gradientRadius="110"/> </shape> place on Map if (mDotMarkerBitmap==null){ int px =

android: how to draw a simple line and display it in a widget?

假装没事ソ 提交于 2019-12-08 12:05:55
问题 i want to visualize stuff with a widget by drawing some lines. lets just say i get two coordinates (x,y) every n seconds and then want to update the widget accordingly. this works just fine by now, but now i want to actually DRAW a line between those two points. i googled around and found many things, but nothing explaining the fundamentals of drawing on an image. since i have NO experience with graphics, i imagine these things to work somehow like graphics drawn with tikzpicture in LaTeX.

drawable-land vs drawable

ぃ、小莉子 提交于 2019-12-08 07:47:00
问题 I am not using a layout-land, but do have drawable-land. The problem is, it uses whichever drawable matches the orientation when the activity starts . I would like it to switch between using the drawable/drawable-land when the phone rotates. Is there a way to do this easily? Or should I just copy and paste my layout into layout-land, so that it actually recreates the activity? (I assume that would do the right thing, but ideally I would like it to just refresh the drawable using the correct

ShapeDrawable(from a PathShape) not drawing on correct coordinates

喜你入骨 提交于 2019-12-08 05:11:34
问题 I'm trying to create a ShapeDrawable that draws the following path: Path path = new Path(); path.moveTo(50, 20); path.lineTo(0, 50); path.lineTo(50, 100); ShapeDrawable shapeDrawable = new ShapeDrawable(new PathShape(path, someNumber ,someNumber )); Then I put shapeDrawable as the top layer of a Layer drawable like so: Drawable layers[] = new Drawable[2]; layers[0] = res.getDrawable(R.drawable.crawford01); layers[1] = shapeDrawable; LayerDrawable layerDrawable = new LayerDrawable(layers);

memory of drawables, is it better to have resources inside APK, outside APK or is it the same for memory?

不问归期 提交于 2019-12-08 04:57:11
问题 I have an application that draws a lot of graphics and change them. Since I have many graphics, I thought of having the images outside the APK, downloaded from the internet as needed, and saved on the files application folder. But I started to get outOfMemory exceptions. The question is: Does android handle memory different if I load a graphic from APK than if I load it from 'disk'? code using APK: topView.setBackgroundResource(R.drawable.bg); code if image is outside APK: Drawable d =

Place Icon at Top Left Corner in Multiline EditText

╄→гoц情女王★ 提交于 2019-12-08 04:28:23
问题 How Do I place icon at top left corner in multiline EditText, here is what I am using : <EditText android:id="@+id/editComments" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="10dp" android:paddingTop="10dp" android:paddingBottom="20dp" android:paddingRight="10dp" android:layout_margin="10dp" android:hint="Comments" android:inputType="textMultiLine" android:lines="4" android:drawablePadding="20dp" android:minLines="4" android:gravity="top|left"

how to create a semi oval shape (bending a line)

徘徊边缘 提交于 2019-12-08 04:27:39
问题 I'm trying to create a custom shape for my NavigationView footer, as background. but it's not so clean. This is what I have done: And this is what I need: Code: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:gravity="bottom"> <shape android:shape="rectangle"> <solid android:color="@color/darkerGray" /> </shape> </item> <item android:gravity="bottom|center_horizontal" android:top="50dp"> <!--android:top="-40dp"-->

Android, Hide stock toggle when using custom background?

自闭症网瘾萝莉.ら 提交于 2019-12-08 04:02:15
问题 I've got a custom drawable for my toggle switch // toggle_selector.xlm <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/toggle_on" android:state_checked="true"/> <item android:drawable="@drawable/toggle_off" android:state_checked="false"/> </selector> Which I then apply to the switch <Switch android:id="@+id/geoLocationsToggle" android:background="@drawable/toggle_selector" android:layout_width="0dp"

Android LayerDrawable.setDrawableByLayerId not working on HTC Sensation (and others?)

心已入冬 提交于 2019-12-07 18:08:54
问题 I am using LayerDrawable to build up a series of hotspots (indexes 1+) on an underlying image(index 0). The hotspots are added based on user interface interaction, and their position is dynamic, so I'm doing all of this programatically rather than using XML. As a further (probably irrelevant) detail, I am using a Fragment to hold the LayerDrawable, as this is in the contexts of an FragmentStatePagerAdapter and ViewPager. The problem is that when I try to update an image by changing the