xml-drawable

set shape background to transparent in android

时光总嘲笑我的痴心妄想 提交于 2019-12-04 17:44:32
问题 I have a shape drawable that I want to use as a background. I want the shape to be transparent. But so far it's not. How do I do that? Here is what I have: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:padding="10dp" android:shape="rectangle" > <solid android:color="#80000000" /> <stroke android:width="1dip" android:color="#000000" /> <corners android:radius="10dp" /> </shape> I expected the line <solid android:color="

How to create customized text input layout like attached design.?

徘徊边缘 提交于 2019-12-04 14:55:56
问题 I tried many custom drawing and I don't have idea about this design.Anyone help me out to do this design on drawable or any other way. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <stroke android:color="@color/black" android:width="2dp"/> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="5dp" android:bottomLeftRadius="5dp" android:topLeftRadius="0dp" android:topRightRadius="0dp"/> 回答1: You can

how to change the image of a button with every click?

喜欢而已 提交于 2019-12-04 12:00:09
问题 I created a button in the layout . In the Drawable folder I created a XML file named btn01_state . The btn01_state.xml is assigned to the button i created through " android:background=@drawable/btn01_state " Now, the button has a default image img1.when i click on the button , the image1 changes to img2, and once i release the clicked mouse button, the image2 again changed to img1 again. what i want to do is,to change the image of the button with evey click. for an example, initially btn01

round corners with border color

不想你离开。 提交于 2019-12-03 22:23:55
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 outer edge of the layout and the inner edge of the black outline makes a rectangle with sharp edges. How

How do I make a drawable from multiple images?

允我心安 提交于 2019-12-03 15:30:21
问题 I have three 9-patch PNG's which together make up the background for a button (left side, middle, right side). I would like to combine these three images together in a drawable which I can specify as the background for a button in XML, something along the lines of: res/drawable/button_background.xml: <?xml version="1.0" encoding="utf-8"?> <nine-patch xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/button_left_side" /> <nine-patch android:src="@drawable/button

Rectangle inside another rectangle

点点圈 提交于 2019-12-03 08:29:30
Is it possible to create drawable from xml like on the picture? The first rectangle contains a second rectangle. If yes, please explain to me how. If you want simple rectangles you could use a LayerList with two shapes as content: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#a1a1a1" /> </shape> </item> <item android:top="5dp" android:right="5dp" android:bottom="5dp" android:left="5dp"> <shape android:shape="rectangle"> <solid android:color="#f1f1f1" /> </shape> <

how to change the image of a button with every click?

孤街醉人 提交于 2019-12-03 07:51:35
I created a button in the layout . In the Drawable folder I created a XML file named btn01_state . The btn01_state.xml is assigned to the button i created through " android:background=@drawable/btn01_state " Now, the button has a default image img1.when i click on the button , the image1 changes to img2, and once i release the clicked mouse button, the image2 again changed to img1 again. what i want to do is,to change the image of the button with evey click. for an example, initially btn01 has img01 if btn01 is pressed==> set img of btn01 to img02 and keep img02 till the btn01 is pressed again

how to get android gradient center light effect?

我与影子孤独终老i 提交于 2019-12-03 06:20:52
问题 i want something like following image i tried it using drawable shape <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="360" android:centerX="50%" android:centerY="50%" android:gradientRadius="50%" android:endColor="#000000" android:centerColor="#FFFFFF" android:startColor="#000000" > </gradient> </shape> 回答1: Make a new Android xml file (say GreyRadial.xml) file in your drawable folder

Change shape border color at runtime

删除回忆录丶 提交于 2019-12-03 04:27:06
I have this shape in my drawable folder: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="5dp" /> <solid android:color="#ffffff" /> <stroke android:width="2dp" android:color="#B5B5B5"/> </shape> This define a rectangle with rounded corners and I can apply it as background to any panel like this: android:background="@drawable/round_corner_shape" . Here comes the question: I have few panels on my application, with the same shape as background, but for each shape I want a different border

how to get android gradient center light effect?

╄→гoц情女王★ 提交于 2019-12-02 18:49:34
i want something like following image i tried it using drawable shape <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="360" android:centerX="50%" android:centerY="50%" android:gradientRadius="50%" android:endColor="#000000" android:centerColor="#FFFFFF" android:startColor="#000000" > </gradient> </shape> Make a new Android xml file (say GreyRadial.xml) file in your drawable folder In your xml file <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com