android-drawable

Defined custom shape for button in xml. Now I want to change the color dynamically. How?

自古美人都是妖i 提交于 2019-11-27 07:33:17
问题 I have this: round_button.xml <xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="oval"> <solid android:color="#dec60000"/> <size android:width="150dp" android:height="150dp"/> </shape> </item> <item android:state_pressed="false"> <shape android:shape="oval"> <solid android:color="#860000"/> <size android:width="150dp" android:height="150dp"/> </shape> </item> My Button: <Button

How to draw a circle inside a circle using Android xml shapes?

*爱你&永不变心* 提交于 2019-11-27 07:12:54
I'm trying to make a thumb for a seekbar for my app, and I want to have an inner circle surrounded by a different, larger (semi-transparent) outer circle. I'm trying to use layer-list , but I'm having issues. Below is my code... <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="oval" > <solid android:color="#00f" /> <size android:height="15dp" android:width="15dp" /> </shape> </item> <item> <shape android:shape="oval" > <solid android:color="#f00" /> <size android:height="10dp" android:width="10dp" /> <

Android setBackgroundResource cause out of memory excepiton

好久不见. 提交于 2019-11-27 07:07:36
I'm working on a gamebook application that shows 12 views in a ViewPager. This is my custom PagerAdapter : private class ImagePagerAdapter extends PagerAdapter { private int[] mImages = new int[] { R.drawable.copertinai, R.drawable.blui, R.drawable.azzurroi, R.drawable.rossoi, R.drawable.gialloi, R.drawable.verdei, R.drawable.rosai, R.drawable.grigioi, R.drawable.neroi, R.drawable.arancionei, R.drawable.marronei, R.drawable.violai, R.drawable.ulm }; @Override public int getCount() { return mImages.length; } @Override public boolean isViewFromObject(View view, Object object) { return view == (

Progress bar with rounded corners?

依然范特西╮ 提交于 2019-11-27 05:14:17
问题 I am trying to achieve this progress bar design: The current code that I have produces this: This is the code: <item android:id="@android:id/background"> <shape> <corners android:radius="8dp"/> <solid android:color="@color/dirtyWhite"/> </shape> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="8dp"/> <solid android:color="@color/colorPrimaryDark"/> </shape> </clip> </item> My progress bar: <ProgressBar android:id="@+id/activeProgress" style="?android

PhoneGap Android: How to force Application to use icons from asset\\www\\res instead res\\drawable folder?

北战南征 提交于 2019-11-27 04:39:42
I have created new Android phonegap project using eclipse and put my existing WWW folder of my iphone phonegap project. I have all the icons and screen added for android device inside Android folder as show here.. and also added it to my config.xml For HDPI I have following icon and screen. assets\www\res\icon\android\icon-72-hdpi.png assets\www\res\screen\android\screen-hdpi-portrait.png When I run the application in Emulator, it keep showing the default PhoneGap icons and splash screen. I have added icons and screens for LDIP, MDPI, HDPI, XHDPI. here is my config.xml <icon src="icon.png" />

How to upload an image in parse server using parse api in android

旧城冷巷雨未停 提交于 2019-11-27 03:59:13
I want to upload an image in parse cloud server in android. But I am unable to do so. I have tried the following code: Drawable drawable = getResources().getDrawable(R.drawable.profilepic) ; Bitmap bitmap = (Bitmap)(Bitmap)drawable() ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] data = stream.toByteArray(); ParseFile imageFile = new ParseFile("image.png", data); imageFile.saveInBackground(); Please let me know how can I do it. I've added a bounty to find the best definitive code for this common problem Save

how to add shadow effect on drawable in android

耗尽温柔 提交于 2019-11-27 03:48:42
问题 I have created chat bubble with drawable which looks fine, now I want to add shadow effect below the drawable so it make 3d effect.I don't want to use 9-pitch image. I just want to know how i can add shadow effect on this drawable. my code is ----right_bubble_chat_drawable <?xml version="1.0" encoding="utf-8"?> <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="15dp" /> <solid android:color="@color/chatrightbubbleColor" />

How to return to default style on EditText if I apply a background?

▼魔方 西西 提交于 2019-11-27 03:43:49
问题 I just encountered with a problem that I don't know how to solve. It looks silly but I cannot find a way to fix it. I have a form in android with several EditText and when you submit the form it checks those EditText and if they have wrong data I change the EditText to red border (applying a ninepatch image). myEditText.setBackgroundResource(R.drawable.edittext_red); The problem is, I want to restore android's default style when the user change the EditText, but I don't know how to do it. if

Creating & Using 9-patch images in Android

半城伤御伤魂 提交于 2019-11-27 03:30:11
I recently heard about 9-patch images. I know its 9 tiled and is stretchable. I'd like to know more about it. How can I create a 9-patch image? Is there any tool? Can I create it from AndroidSDK or code? Main Advantages of 9-patch over regular png? (is it stretchable dynamically/ automatically according to screen?) Today I discovered nine patch images. The official documentation (linked to in the other answers) is ok I suppose, but it really lacks in examples. This little tutorial has some great examples at the end that answer the second part of your question, explaining how the scaling works

Android Zig-Zag layout

懵懂的女人 提交于 2019-11-27 02:58:49
问题 I'm in need of creating a receipt layout in Android. The idea is very simple, a rectangle layout with a zigzag top. Even, i have tried dashed line but nothing working. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:color="#FF00" android:dashWidth="5dp" android:dashGap="5dp" /> </shape> 回答1: Try with this: https://github.com/beigirad/ZigzagView Support top and bottom Zigzag. <ir.beigirad.zigzagview.ZigzagView android:layout_width="match