I'm searching over the Internet a beautiful frame/border to insert for an image in an imageview....i'm not able to find nothing good.
Now I have this code that insert just a black border, but I would like something more impactive and more beautiful.
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF" />
<stroke android:width="3dp" android:color="#000000" />
<padding android:left="3dp" android:top="3dp" android:right="3dp"
android:bottom="1dp" />
</shape>
Moreover I would like to implement an animation over this image for example when touched that something happen, like that some information happear or the image increases it size. Can someone suggest me some good idea to implement these two things with some good code or some link!!!
You can add corners tag to give it a look of rounded frame.
Related
I want to make a textview background like in the screenshot. I have a xml file that can make rectangular background like in the screenshot but i am not able to do that below corner styling. I dont know what thing can change this.
Here is my xml file that can give a rectangular background to my textview.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="#color/orange" />
<solid android:color="#color/orange" />
<padding
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<corners android:radius="5dp" />
</shape>
Your best bet here would be to make a nine-patch image. Roman Nurik has made a really nice nine-patch generator that you can use. Then you just set the image as the background and it will stretch like you think it should.
Sorry if this is a very simple question; I'm still new to a lot of Android and am learning as I go!
I currently have a shape specified in the drawable folder for a black rectangle at 60% opacity that takes up all of the screen- it creates something of a "tinted window" effect when placed over a picture.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="#+id/tinting_rectangle">
<stroke android:width="2dp" android:color="#ff207d94" />
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<corners android:radius="5dp" />
<solid android:color="#99000000" />
</shape>
My goal, however, is to create a circular "opening" in this tinting, right in the middle of the rectangle. Basically, a transparent oval that allows you to see past the tinting in that one spot to see the background underneath.
I had imagined it would be something like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="#+id/tinting_rectangle">
<stroke android:width="2dp" android:color="#ff207d94" />
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<corners android:radius="5dp" />
<solid android:color="#99000000" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="#00FFFFFF" />
<padding
android:left="#dimen/tint_padding"
android:top="#dimen/tint_padding"
android:right="#dimen/tint_padding"
android:bottom="#dimen/tint_padding" />
</shape>
</item>
</layer-list>
However, that did not accomplish the goal I was looking for; I still just have a giant solid rectangle of 60% opacity black.
Does anyone have a suggestion for what might accomplish this in XML (looking to keep this as a nodpi solution if possible)? A "tinted window" rectangle with a hole in the middle to see through to whatever is behind it.
Thank you!
EDIT: Additional: As you can see the oval in the second example I am using static padding to center it in the rectangle. Obviously this won't work. If anyone has a good suggestion how to make sure the oval is always centered in the rectangle, that would also be greatly appreciated!
I'm trying to add 3d effect as background of TableRow using gradient, is there a way to make it appear like a stair 3D effectlike that:
And wanna my text appear like a box placed on each stair.
Currently i'm using:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#77F3AE1B"
android:centerColor="#77F3AE1B"
android:endColor="#77AA893C"
android:angle="270"/>
<padding android:left="4dp"
android:right="4dp" />
<corners android:radius="4dp" />
</shape>
but don't look really as 3d effect, i've try to use image background but have lots of problems bcs of screens dimentions and orientation!
i want to get rounded corners for images in a custom list. I used the custom widget method mentioned in the following link:
http://wiresareobsolete.com/wordpress/2011/08/quick-rounded-corners/#comments
The image corner is getting blurred. Can any body give me a solution to have smooth corners using this mentod.
Make one file in drawable folder. Name any thing to it. And set the imageview background by using that file. It will give you a round corner.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dip"
android:color="#color/stroke_color"/>
<solid android:color="#color/white"/>
<padding
android:left="5dip"
android:top="5dip"
android:right="5dip"
android:bottom="5dip" />
<corners android:radius="5dip" />
</shape>
In my application, I'm (still) trying to manipulate my Button Views to look the way I want. I'd like to attempt an experiment where I'll draw an Android Rect or RectF in the same location as the (transparent) button to highlight it's appearance.
However, I can't figure out how to get my mitts on that information. The buttons in question are defined in XML, in a Linear Layout, but something inside my Android has to know their sizes and locations. Right?
Any suggestions?
Thanks, R.
You should be able to set a background of the button to a custom xml drawable with the drawable containing only stroke element around the edge.
You will need to create this custom drawable: it would be just a few lines of XML.
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:width="1dp" android:color="#CCCCCC" />
<corners android:radius="10dp" />
</shape>
Edit: updated to include rounded corners.
This answer is a combination of my poking around and Aleks' suggestion to use a custom drawable. Ultimately, my custom drawable needed more than three lines, but it's still not very big:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:startColor="#android:color/black"
android:endColor="#android:color/black" />
<stroke
android:width="1dp"
android:color="#cccccc" />
<corners
android:radius="5dp" />
<padding
android:left="4dp"
android:top="2dp"
android:right="4dp"
android:bottom="2dp" />
</shape>
</item>
</selector>
I needed to add all of the other detail to get the custom button to work the way I wanted -- and I'm probably not done, but if anybody is interested, this works pretty well...