In my app i need to create cardview with curved top and bottom lines, like this:
I tried to search answer on stackoverflow and google but i haven't found anything. Also i tried to make it via xml, but i couldn't.
Can anyone help me with this? I can't use it like image background because i need to change background color when i click on card and i have a lot of such card in my recyclerview and a lot of different colors for every card.
Thx.
You need to use a custom shape a la this as the background of the view. edit see this post
Related
thank you for answering me
I just want to know how i can make the shadow below this card
I already tried several ways like Elevation... but it didn't work for me.
I searched a lot about it and I found that website :
Shadow generator
But i'm wondering if there is another way, using xml or anything else.
You are half right in that elevation is required for a shadow effect.But note this is only applicable to view that are not buttons. For buttonViews you can add a statelist animator that handles the properties of a button for all its states.Also if you are using something like a textView that does not have any margins you might as well use a background to show the shadow as follows:
android:elevation="30dp"
android:background="#000"
For other views, this means simply adding the elevation attribute as shown above and the background is not required
This link will help:
How to provide shadow to Button
So lets say I have a segmented circle image asset inside an 'ImageView' widget, and I want to use each segment of that circle as a clickable surface to bring up a fragment with an image and some info.
Is there any way to build transparent arrangeable borders that I can use to do this with?
I'm using android studio with the default NavigationDrawer activity if that helps.
Maybe adding some ImageViews with transparent images on top of each section and making them clickable? That's how I'd do it. Of course this won't cover perfectly the area but it may work for what you need it.
So I found this. In case it can be of help to anyone else:
https://github.com/anupcowkur/Android-Wheel-Menu
I'm trying to use a listview in my application with a gradient from the bottom.
I do not want to use the gradient in the background, I like to use it in the listview.
To try to explain better, I attached a picture of what I want.
The background will show images that will change.
I searched a lot and made several tests, but without success.
I appreciate any help.
Thanks and regards
Android has something built in for that. It is called fading edge. The two XML properties are android:fadingEdgeLength and android:requiresFadingEdge. If you were hoping to have the image gradient change, I don't think they are dynamic.
HI,
I'm trying to achieve a custom buttons . I'm wondering how I can achieve this with Android.
The result should look similar like this,
how I can make special shapes adjacent the problem it is because the image of each button must always be rectangle.
Thanks.
You can create custom backgrounds (shapes, colors, etc..) using xml drawables.
You should check out the documentation and the samples, like this one:
I was wondering if there is a simple way to style a ListView along with it's items like the conversation in android's text message app. There are rounded corners and stuff like that, where I'm not sure how I could implement this myself.
I know that I could look for the source code of it, and try to copy from there, but it's a huge app with a lot of files and that's why I decided to ask first.
Thanks in advance,
Jan Oliver
I don't see any rounded corners in the stock sms app...? Either way, rounded corners are quite easy to do with 9-patch png files. Other than that the styling of the sms app is pretty simple. It contains a couple of TextViews, and one QuickContactBadge, a few different background colors, and that's it.
Here is a good place to start https://dl.google.com/googleio/2010/android-world-of-listview-android.pdf
you are basically going to want to use an Adapter to inflate views you make in the xml editor. Once you have more specific questions we can go into more detail.