I want to make a custom layout like below view.
In this view I want to make TextView half sliced from one end and another ImageView from another end. So please tell me how to make such custom TextView and ImageView with diagonal clipped from one side.
With reference from this answer you can use this view and customize it horizontally instead of vertical.
Or you can also check for this code as well which something like below image.
Reference also available here
Related
Looking for your help. I am using constrain layout. On top of blue rectangle, I have other elements too, but not sure how to achieve the layout that I have shown in the image.
I tried using card view and text view and button inside it. Please let me know if I miss any details or some information is required. Just looking for better approach.
I tried using card view and text view and button inside it
This is fine. And you will need another layout inside CardView because CardView can only hold one child. You can use ConstraintLayout,LinearLayout, RelativeLayout... to hold your TextView and Button.
Is there any way to make following Layout in Android..? If yes please suggest how to make and how to set clickListener's of overlapping areas of Views...? i.e View 2's area overlaps 1's area and View 3's area overlaps 2'sand 4's area and so on others views overlaps..? If there is any android library to make non-rectangle buttons/Views also suggest.. Thanks.
Here is one way that this may work:
Use a rectangular ImageView for each shape. Make sure each shape is clickable.
Shape images will have a transparent portion where they fit together.
Use FrameLayout or some similar layout that will allow overlapping of Views. You will have to work with how each View overlaps.
Make the transparent portions un-clickable. See this Stack Overflow question and its accepted answer regarding one way to do this. (N.B. I have not tested this.) You should be able to work it so that clicks propagate downward to an underlying ImageView when a transparent region is clicked.
An alternate way would be just to have two views (left and right) and implement a View.OnTouchListener to determine where the click occurs by looking at adjoining pixels: their color and placement.
Good luck!
I'm new in android design.
I want to create a view like this:
In fact, I want to create two things:
A header like this image header that has an image with a transparent overlay.
Like my header, I want to create recyclerview items, with image and transparent overlay too.
It is necessary to mention that, I want to use Picasso library to show my images.
How to I create this.
Thanks a lot.
For grid element you can use RelativeLayout. On the first layer put ImageView with your image, above this you can put View with overlay background (for example semi-transparent black color), and then you can add your text. If you want to create text like on your image (two TextViews above center) you can put empty View element with some height (this height will be like margin between two TextViews) and in top text add layoutAbove="centerViewId" and in bottom text: layoutBelow="centerViewId". I can paste xml code if you want, but I think in this way will teach you more.
I am trying to create an UI just like the attached image!
How do we create these types of UI? Is it a ListView? And how do we get the arrow button on the right hand side? How should I start with such kind of layouts?
You can achieve that with a LinearLayout too.
Have that LinearLayouts orientation be vertical. Create such list items (it isn't related to ListView) using RelativeLayout.
Have the icon be an ImageView aligned to its parent left and vertically centered, the text would be a normal TextView which is to the right of that icon and vertically centered as well and finally another ImageView but this time aligned to its parents right and vertically centered.
These is the receipt.
It's a ListView, you should learn how to write your own ArrayAdapter and returns in the getView method the View you want to be each row of the ListView.
AnDroidDraw lets you create the layout online and then later download it on your device. http://www.droiddraw.org/
Create appropriate custom ArrayAdapter for this layout.
I've got a ListActivity with a ListView in it. I need to draw a repeating image around the border ("on top of it (I guess after the listview is renderered))
How can I hook in my own drawing code for this?
You can use a FrameLayout to cause the ListView to overlap with a view that fills the entire screen. In this background view you could tile an image, or write your own custom View with your own drawing method.
There is no border property in ListView, as far as I know.
Instead you can put ListView into a FrameLayout and set the Background color of the FrameLayout.
Finally, set some padding to FrameLayout in order to create a border effect.
Hi
There is one way I have used, but that can be done in XML only.
android:background="#ffffff"
android:divider="#ffcccccc"
android:dividerHeight="1dip"/>
What I am doing is, putting listview in a LinearLayout. Background color of the list is different than that of layout. There is a margin set for layout. Hence the distance between list and layout will appear like a border for the listview.
Hope this helps.