xml-drawable

Android Drawable Horizontal Line

我与影子孤独终老i 提交于 2019-12-11 01:59:39
问题 Is it possible to make line to be like this with xml? or there's some way to do that..? I already made some drawable with shape but it's not really like i want <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:bottomLeftRadius="30dp" android:bottomRightRadius="30dp" android:topLeftRadius="0dp" android:topRightRadius="0dp" /> <padding android:bottom="0dp" android:left="0dp" android:right="0dp"

Using theme references in XML drawables requires API level 21

北战南征 提交于 2019-12-10 14:33:23
问题 Is there a way to make following code compatible with lower API levels: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="?android:attr/selectableItemBackground"/> <item android:gravity="bottom"> <shape android:shape="rectangle"> <size android:height="1px"/> <solid android:color="#ccc"/> </shape> </item> </layer-list> The part: android:drawable="?android:attr/selectableItemBackground" produces this message: Using theme references in XML drawables

error: too many padding sections on right border

浪子不回头ぞ 提交于 2019-12-08 07:53:01
问题 when i build my project it give me error like I found the reason that, because of 9 patch file i am getting this error. so can any one please look at this 9-patch file for whats wrong in this below image. also i am using layer list for this drop down which is below drop_down_drawable.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <corners android:radius="2dp" /> <stroke android:width=

Setting Background Drawable with states to android buttons

╄→尐↘猪︶ㄣ 提交于 2019-12-07 11:52:52
问题 I am building a multiple choice questionnaire android program. I have the following in my onCreate() method btnArray = new Button[5]; btnArray[0] = (Button) findViewById(R.id.bOp1); btnArray[1] = (Button) findViewById(R.id.bOp2); btnArray[2] = (Button) findViewById(R.id.bOp3); btnArray[3] = (Button) findViewById(R.id.bOp4); btnArray[4] = (Button) findViewById(R.id.bOp5); Typeface othmanyFont = Typeface.createFromAsset(getAssets(), "fonts/amiri.ttf"); Drawable shape = getResources()

How to create android drawable consisting of two colors side by side?

亡梦爱人 提交于 2019-12-07 10:54:28
问题 Uisng XML is it possible to create a drawable where half of it would be color1 and another half would be color2? When I set that drawable as a background of a view it should look like in the image below. 回答1: Doing it by xml: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:right="100dp"> <shape android:shape="rectangle"> <size android:height="100dp" android:width="100dp"/> <solid android:color="@android:color/black"/

Selector, Layer-list and shape/bitmap in the same xml

久未见 提交于 2019-12-06 22:44:53
问题 I have this code in an xml inside the drawable folder: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <layer-list> <item> <shape android:shape="rectangle"> <size android:width="90dp" android:height="90dp" /> <solid android:color="#9933CC" /> </shape> </item> <item> <bitmap android:gravity="center" android:src="@drawable/main_achievements_synthesis" /> </item> </layer-list> </item> <item> <layer

error: too many padding sections on right border

不打扰是莪最后的温柔 提交于 2019-12-06 15:13:57
when i build my project it give me error like I found the reason that, because of 9 patch file i am getting this error. so can any one please look at this 9-patch file for whats wrong in this below image. also i am using layer list for this drop down which is below drop_down_drawable.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <corners android:radius="2dp" /> <stroke android:width="1dp" android:color="@color/black_c4c4c4" /> </shape> </item> <item android:bottom="@dimen/margin_8"

How To Create A Custom Ring shaped drawable android

核能气质少年 提交于 2019-12-06 05:45:41
问题 How can a achieve a curve like this: 回答1: The easiest solution would be to use a VectorDrawable . Create a new drawable custom_ring.xml <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="100dp" android:height="100dp" android:viewportHeight="700" android:viewportWidth="700"> <path android:pathData="M0,0Q350,150,700,0L700,200Q400,300,0,200" android:strokeColor="@color/colorPrimary" android:strokeWidth="1" android:fillColor="@color/colorYellow"/> </vector> And then

round corners with border color

99封情书 提交于 2019-12-05 09:41:00
问题 I am using the following code to get rounded corners as well as a colored outline: <?xml version="1.0" encoding="UTF-8"?> <gradient android:startColor="@color/white" android:endColor="@color/white" /> <corners android:bottomRightRadius="2dp" android:bottomLeftRadius="2dp" android:topLeftRadius="2dp" android:topRightRadius="2dp"/> <stroke android:width="5dip" android:color="@color/black" /> The image displays what I'm getting right now. Due to the stroke , the rounded corners only lie on the

Selector, Layer-list and shape/bitmap in the same xml

烈酒焚心 提交于 2019-12-05 04:01:29
I have this code in an xml inside the drawable folder: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <layer-list> <item> <shape android:shape="rectangle"> <size android:width="90dp" android:height="90dp" /> <solid android:color="#9933CC" /> </shape> </item> <item> <bitmap android:gravity="center" android:src="@drawable/main_achievements_synthesis" /> </item> </layer-list> </item> <item> <layer-list> <item> <shape android:shape="rectangle"> <size android:width="90dp" android:height="90dp" />