Custom ImageView with custom styling (How-To, Name) - android

I'd like to know the name of such effect to the following screenshot. For example, the image is full loaded as a Rec, then it has an extra space with an angled white/dark space.
I literally have no idea how to better explain this.
I don't want a code sample, just hints so i can know how to do such custom styles.

The first and second screenshot: you can use Relative Layout
Firstly, insert the imageView, then insert the white layout with needed dimensions and margins, so it will overlap the imageView.

Related

How to create 9patch from image with icon on one side

I'd like to 9patch this image, but I can't seem to
I've tried understanding the things mentioned here https://software.intel.com/en-us/xdk/articles/android-splash-screens-using-nine-patch-png but I can't seem to apply them to my image
Any ideas? And yes, it doesn't help that the icon is rounded ...
According to the linked page you "draw lines that define the stretchable patches.". In your case, the stretchable part seems to be left of the logo until the left half-circle starts.
I added an image with an oversized stretch-line to mark the horizontally stretchable part.
There is no way, to use your image only with 9 path. Best practices for your task - using several images with 9 path. Maybe creating custom view.
1) As you can see, first image, parent with blue color, should include 9 path (it's easy to make without internal image).
2) For best looking in any device you need to create another thing for second image (with facebook char). 9 path for circle - not best idea. So I advice you use holder, with xml canvas background and char "f" in foreground.
3) Now you need to put this all in one FrameLayout, which you will use anywhere. All structure will be as example below:
<FrameLayout> // You may create custom view instead of FrameLayout
// for more flexible and understanding
<BlueImageBackground.9path
gravity=center>
</BlueImageBackground.9path>
<WhiteImageFacebokChar
gravity= center_vertical | left>
</WhiteImageFacebokChar>
</ FrameLayout>
As a result, in any screen, this image will appear identically...
The source image you provided should be edited first, my version:
in sdk/tools folder there is draw9patch tool, so you can use it to edit it. You would see something like this:
Hi it is preferable to create an empty 9 patch image "without the logo" and then setting it as the background of a relative layout and then add an image view to the relative layout and add to the ImageView:
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
Moreover you have to adjust the margin of the image view to achieve the desired result.
Note that this method will not stretch the icon & it requires some fine tuning to the image size and padding to achieve the desired results :-)

Android border around textview just on the base and partially on the right and left walls

I need to get a border on the base of my android text view, it should look something like the count down -1:29 timer. I know I can create a image and put it on the background, but I need it to be a layout xml kinda thingy so that it adjusts with size of the text within for all phones.
Use a 9-patch image that can stretch horizontal and place it as a background. That is all you need.

How to create round shape image using android?

I am having four piece of image.
Here I attached one sample image.
How can I create the round shaped image using these type of images?
Which layout is best for creating the UI for android?
Thanks in advance.
are you talking about something like this..
http://www.baijs.nl/tinycircleslider/
And for designing the UI for Android is depends on our requirement.it means whether you want to design something looks like rows and columns then GridLayout and tableLayout will be better,depends on requirement and look the layout will changes once try it your self and choose the best suited for your applicaiton.All the best Mate
inside relative layout add four imageview with attrs ParentTop, ParentRight, ParentBottom and ParentLeft. every image is rectangular with transparent extra area.
i can understand it is little hard to visualize on first attempt.
now come to click area. so a runtime decision about ignore transparent area click will be right thing.
more tricky way will be manage flags for all listeners and if two listener get calls its transparent area .

header image dimensions layout and layout-land

i cant seem to figure out how to get my header to look correctly.. there's either white space in one view or the other.
is there a way to use two separate images with different dimensions?
I either get it looking like this
screenshot1 http://m4x.co/m/s1.png screenshot2 http://m4x.co/m/l1.png
or.
screenshot3 http://m4x.co/m/s2.png screenshot4 http://m4x.co/m/l2.png
but.. i want
screenshotideal1 http://m4x.co/m/s1.png screenshotideal2 http://m4x.co/m/l2.png
To get rid of the white space you can use negativ margin in picture style <img src='some_picture.png' style='margin-left:-10px; margin-right:-10px;'>.

Convert an image to Color object which can be added to background of a Layout

I am having the following requirement.
1> I have a background image(png) (containing various shades) of color with stripes.
Is there any class which is already available on Android using which I can convert the image to Color object & set on the layout as background color?
Will the ColorMatrix class help ? I want to avoid using the image as background , as with different screen resolutions , even after having separate drawable folders , there can be cases when the background image can get stretched , giving a wrong view .
Kindly provide your inputs/sample code. If my approach is incorrect , kindly provide the correct logic.
Thanks in advance.
Warm Regards,
CB
This is a confusing question...what kind of background image is this? If it's just a gradient, you can create one using ShaderFactory programmatically. And if it's something that doesn't have a lot of fine detail, you can just use a single image, and just have it scale to fit the screen. Rather than using the android:background attribute, a trick you can use is to wrap your layout in a FrameLayout, and add an ImageView behind the rest of your layout, with the background set as your ImageView's source. Set the scaleType to something like centerCrop, and it will scale proportionally.
Can you give an example image?

Categories

Resources