Customising top of DialogFragment - android

Maybe some kind of simple question to those who are skilled at android layouts, but what is the best approach to draw smth like this (maybe what widget to use) for positioning rounded area which spreads out of top border of dialogFragment and is horizontally centered like this:

You will have to create a custom layout for Dialogs.
In this case, you have all the control you want for defining dialogs layout, same as for any view.
If heart icon is all you have, create an xml for white circle and use it as a background for the heart, set it to top of parent, center it horizontally.
As you will have exact height of circle, you can set half of it as top margin for the rest of the layout below to make circle look like a hump (as on screenshot).

You can use a 9 patch as the background of you dialog. Define the stretch areas and the content area and you should be good :
And for exemple use this 9 patch file:

Related

How can I make an android layout with four quadrants and a circle in between

I'm trying to design a layout with four divided columns and a circle in the center something like the image in the link below. Any help would be appreciated
A simpler approach would be to design the columns and circle is a single png, and then just show it as a background of the layout and the place the TextView in the desired order of your choosing , and as for the center textView put it inside a Constraint Layout and then center it.
This is how you want it to be, and it can be done like this
You can easily these in Photoshop or whatever tool suits you
On and yess keep in mind that i just moved the column 1px outwards in the respective way so as to create that central divider look since adding individual border to each columns inward side would be more hectic, and this way you just have to move the columns outward (if you move then up remember to move them to left/right respectively or if you move them bottom do the same and move the left/right so as to have them in perfect sync.
Another Method
Another method would be to us each piece of this design individually and them use them as the backgrounds for each TextView or have them as the background for each RelativeLayout 's background and have them as Parent to each TextView.
And As For the Image of the Jersey You place it dynamically in the Relativelayout of the inner Circle.
I hope this helps.

Layout with decreasing height from one end to another in android (inclined on one side)

Here is what I need to attain
The Application logo goes inside that blue background. Can I somehow tweak Linear or Relative Layout to attain that inclined bottom? Or is that any other solution to this, other than simply using an image itself?
No, Views in Android are all rectangular, and LinearLayout and RelativeLayout only deal in rectangular measurements. You're going to have to do some special drawing or use a background image or something along those lines.

How do I create a layout w/ a white background, grey border with a triangle arrow - Android

How would I replicate this in Android, my general instinct would be to create a regular layout w/ a border, then have 2 layouts that contain a triangle (one the same color as the border + one that's slightly smaller but white and overlap the two), idk if there's an easier way to do that:
You can use 9patch to achieve something like you wanted.
The Draw 9-patch tool is a WYSIWYG editor that allows you to create
bitmap images that automatically resize to accommodate the contents of
the view and the size of the screen. Selected parts of the image are
scaled horizontally or vertically based indicators drawn within the
image.
A complete guideline can be found here : http://developer.android.com/tools/help/draw9patch.html
The easiest way to reach this, is to set the layout background to that image.
background="#drawable/template"
Probably you want to have the area out of the "bubble" transparent, so you will need to save it as PNG.

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.

Preventing Pixelation of Images, indenting listViews and adding Rounded corners

I have a few issues and questions regarding some UI development on Android. Firstly look at this image:
Firstly at image A) This is a image that I insert and repeat horizontally to give the zig-zag shape at the top of the screen regardless of screensize and above that a textField with no content and a background color - But as I'm sure you can is that the two colors don't match up quite as perfectly as it should even though they both have the same hex color value (#BF0426). And secondly, you can also see some serious pixelation on that zig-zag image. How do I fix these 2 problems?
And then at image B) Here I have a simple listView. What I would like to do, is firstly indent it a bit on both sides, and round the corners of the top and bottom item. So basically I want it to look like the blue border drawn on the screenshot. (Your typical iOS listView). How do I go about doing this?
Thanks in advance for any tips!
For the image. Just out of curiosity, why wouldnt you simply extend your image to include the top pixels as well? In other words, build your repeating image such that it incorporates the pixels that you are trying to create using the empty textview. This will at least take care of the color missmatch, as the color will all be generated from the same place. In terms of the pixelation. Are you truly repeating the image, or are you spreading the image. A spreading will definitely cause what you are seeing.
For your tableview:
For the left and right indent, you can simply use the margin or padding attributes of tableview item. There are generic padding and/or margin attributes (which will pad all of the top, bottom, left and right), or there are separate padding and/or margin attributes for each top, bottom, left, and right. Here is a great link on padding versus margin that you may want to read.
Difference between a View's Padding and Margin
Example attribute (as called in an XML file) for bottom margin
android:layout_marginBottom
setMargins(left, top, right, bottom) // for setting margins programmatically
Example attribute (as called in an XML file) for top padding
android:paddingTop
setPadding(left, top, right, bottom) // for setting padding programmatically
For the custom top and bottom, you should be able to use the following tutorial
http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/
From here, you should be able to detect the item as the first and last item and set the background property (image) to a background image that has a rounded top or rounded bottom. This is how I do it on the iPhone. I have also implemented things that LOOK like tableviews but are simply vertical layouts with my own custom views that I have made to look like what you are wanting.
One thing to consider is the file format you use is going to mutate the image as you save it (lossy compression), so a .jpg with a certain color may look different than a .bmp with the same color. Make sure you author using the same application and/or export settings when trying to match up images.
Also, if you created your image with a DPI that is not compatible with the android display it can cause serious pixelation in detail areas, especially with gradients and drop shadows.

Categories

Resources