I am looking for a suggestion how to create a layout which looks like the image above.
I can't figure out how the area in white is done.
Any pointers will be appreciated.
Grav- Gravity/Layout Gravity
Rel Lay - Relative Layout
Txt.V - TextView
Img.V - Image View
L.L - LinearLayout
Ornt - Orientation
Hoz - Horizontal
Ver - Vertical
Set left Layout's L.Height to match_parent, Right Layout's L.Height to wrap_content set min-height to right.layout.
If RelativeLayout is used in Left layout, use align_parentTop center_horizontal align_parentBottom respectively.
You might not get the same while working in eclipse, but will get the required in Device/Emulator. Note, your effort is needed.
Here is a good tutorial on customizing a ListView (Scroll down to Section 1.4): http://www.vogella.com/tutorials/AndroidListView/article.html
If you're looking to make rounded corners you can look at this post:
How do I create a ListView with rounded corners in Android?
Related
I wanted to make a layout which has three children layout.
the bottom layout must visible to bottom
screen size is enough:
the center layout need Dynamically change to wrap_content and we need the bottom layout is under the center layout (not top of the parent).
screen size is not enough:
fix size of center layout will fixed and it is a scrollview, it's height is dependency on the reminding width(if screen size is not enough)
I think a lot of ideas but i don't know how can do using xml. It can be only calculate in runtime?
this is the intend image:
you can use wrap_content in xml
OR
To change programatically you can use following code
Your_Layout.getLayoutParams().height = 100;
At the moment I'm playing a bit with the new ConstraintLayout and try to create the following layout:
(1) Headline: Type 24sp, Leading 32sp
(2) Subhead 1: Type 15sp, Leading 24sp
(3) 32sp line height
(4) 56dp padding between the top of button and the center of copy
(5) 24dp vertical padding
My problem now is that I do not know how I should handle the sizes which refer to the center of the second TextView. We do not have a constraint for the center (or baseline) to bottom or something like this. Also I'm not able to set a space between two views which are connected between the baseline points. So how should I create this layout with the ConstraintLayout?
Can someone please give me a sample layout from the picture above?
We only allow baseline to baseline, without margin for now. We might revisit this in the future, but as of ConstraintLayout alpha 7 you cannot do this. The only option is to align with top / bottom.
You could also add a view with a layout height as a divider, then reference the bottom of the divider
I am trying to align two layouts horizontally but can't seem to get it working. The conditions I need are:
Layout 1 needs to fill up the whole width EXCEPT for the width that layout 2 requires
Layout 2 needs to have a width of 21dp and right / left margin of 17dp.
I can't take a picture because of my job, but here' some ascii art to illustrate what I want:
I attempted using a dummy View between the two layouts so that I could use a relative layout, but that wasn't quite working for me..so any suggestions?
Thanks!
<RelativeLayout layout_width="match_parent">
<Layout1 layout_width="match_parent" layout_toLeftOf="#+id/layout2"/>
<Layout2 id="#id/layout2" layout_width=21dp layout_alignParentRight="true" layout_marginLeft="17dp" layout_marginRight=17dp/>
</RelativeLayout>
Add in the rest of the parameters as needed
Try using a horizontal LinearLayout and set android:layout_weight="1" for layout 2. Like this layout 2 should keep it's size and layout 1 will fill the rest of the available space.
I want to model my layout screen in the following 2 parts.
Basic Information related Linear layout with expandable view initially 20 % of screen height.
Bottom List view occupy Remaining Space.
But When the top view is expanded then i want to make it height upto 50 % and the bottom listview should start then after.
I have attached image for reference.
I have tried setting the layout_weight of top and bottom layout. But not able to find out exact solution. May be i am missing some points.
Let me know if you need more information from my end.
Thanks in Advance.
regards,
Rakesh
Try to remove the current weight from the top view and in the listview set android:layout_weight="1" and android:layout_height="0dp". This makes the ListView to take whatever height left in the screen.
I have a layout with 2 ImageView, for example, a square(part 3) and a rectangle(part 1) as in the attached picture.
I want these ImageView has a clipped part in common ( part 2).
The problem is I must use the RelativeLayout ( for some other reasons).
So, I try to set alignParentLeft for both , and margin left/ margin right properties with hope that they will be clipped.
Any suggestion is appreciated.
Thanks.