I have a transparent listview with a image as background. Now, i want the scrollbar as transparent too, i.e I must be able to see the background image through this scrollbar too. Pls help!!!
Try this:
android:scrollbarThumbHorizontal="..."
android:scrollbarThumbVertical="..."
Where ... is a reference to your transparent drawable.
In your XML, if you add the line
android:scrollbars="none"
your ListView will still scroll, but have no visible scrollbars.
Check out the answer to this post:
scrollBar in a listView...customizing it.
They describe how to create a customized scrollbar with a given image. Your solution would be to create an image with some alpha value as to make it as transparent or as opaque as you want.
Oh yeah, make sure your image is a .PNG file as jpegs do not contain alpha information, so the cannot do transparency.
Related
The problem is that these semicircles should change position depending on the content.
https://i.imgur.com/3DT6qFF.png
I have tried to do this using two CardView, but it was no what I want
Make a drawable png file by photoshop or any other image editing tool and use that in the background instead of cardview.
Hope it will help you to achieve your goal.
Thank you
On Android, I have a header with a background image (Random image according to API).
On this header I have texts with some data. My text is every time black but sometimes image is black too. So, we can't see the text.
I'm looking for library or snippet for resolve this problem.
Thanks.
You can use the palatte library for this. Please see the following:
https://developer.android.com/reference/android/support/v7/graphics/Palette.html
https://developer.android.com/training/material/palette-colors.html
I encoutered this problem months ago and was not really sure how to approach it. First of all you need to use a Layout where you can put View over View for example Relative or Frame. After that you need to make the ImageView thats behind the TextView to be a little bit Lighter or Darker (like a shade) at the place of your TextView so you can choose a color for your text which will always be readable since the shade will be in contrast with the text. What you can do is put something behind the TextView and the ImageView which will be Light or Dark and make the ImageView a little bit transparent using set.alpha(int) if i remember correctly. So at this point you will have transparent image with a light or dark rectangle behind it. It will be visible that the part where you have the rectangle is darker/lighter. Then you put your TextView there with contrast color to the Rectangle and you will always be able to see it. It is kind of complicated, but it will work. Hope it helps.
I think palatte is not available for android. So glide will be a better option. Link
I want to apply shadow at bootom of ImageView as shown in image below.
Any trick to achieve that in android ??
The easiest way that I have seen to do this is to create an image that is just a drop shadow and then set that as the background for the container of your image.
Here is a really great SO thread about how to do just that.
No ,you have to create a image which have shadow as well as border.
so ,after that you have to set padding to your image so it's look like this frame.
I am trying to create a drawable such as this in Android:
I don't think a nine patch will work because there is nowhere that can safety scale vertically. So next I tried a shape drawable but it does not support triangles.
I want to render this image on the fly so there are no artifacts. Also I want to be able to use it in a selector, so I need to be able to represent this image in xml. Maybe I need to extend some class to manually make the shape. If so how do I embed a tag in the xml to tell it where to render? Does anyone know where to start with this or have an example of something similar?
I have read the first 10 pages of hits on stack overflow and google and am not getting anywhere. Thanks very much for any help.
I think a 9-patch would work. For the vertical stretching on the left boundary, fill in the line from top to bottom.
I'm using a layer-drawable and inside it I have one BitmapDrawable that repeats only horizontally. But I need to add borders for this drawable.
But I didn't find any solution for this!
I tried to create a ShapeDrawable and set my BitmapDrawable as background of my ShapeDrawable, but it's not possible.
I tried to find a method that add borders for my ShapeDrawable, but I didn't find it.
I also added 2 other images, that would be the box_top_left and box_top_right.
With this idea, I only need now to make it appear in this order:
box_top_left, box_repeat, box_top_right.
But i'm also having trouble to do this!
I've found a several ways to change a drawable's padding in my xml but not during the execution. I can't just set it on my xml because I don't know the total width.
And I didn't find any way to make my drawable the exactly width of my image.
Can somebody help me, plz?
I'll post some images to help you to understand what I want to do.
The first image is how it should be:
Inside my Dialog, at the top, above the text "Acesso ao sistema" I have my image that sould repeat.
I used a layer-drawable for my Dialog's background with a item that is the shape for my dialog and another item that should have my BitmapDrawable repeating only horizontally.
This second image is only missing to add my box_top_left and box_top_right.
This third image is what happens when I don't use borders:
And the last image is third image expanded for you to see the problem:
Thanks for your attention.
I think using a nine-patch for this will make your life a lot easier.
I think you can try Layer List, and define two items. One item is a shape which you can add stroke to be the border, and the other one is a bitmap which you can set tileMode to be "repeat" to repeat.
I used this method to implement my task. And I ran into one problem which already was fixed.The bug is that the repeat area seems have some lines between images.This may be caused by the shape having default black background. So I set the shape item's color to transparent.
Hope this will work for ya~~