Best practice for android layout -
hi quite new android(about 2 week) , read layouts , attributes
but implementing in best way known skilled programmer confusing , can't on own.
i made layout don't think it's implementation of view.
on image attached, used multiple linearlayout in depth
it looks this. used linearlayout layout_weight
is better use <relativelayout>
or <tableview>
?
i want efficiently implement these things.
is safe use "xx dp" ensure same among different screens?
extra question 1) issues faced when implementing. when multiple "match_parent", example
if have
<linearlayout orientation="horizontal"> <textview width="match_parent"> <textview width="match_parent"> </linearlayout>
it behaves framelayout 1 textview displayed.
what want have static table view has 3 fixed container in ratio 1:3:1
1 3 1 |_ _ |_ _ _ _ |_ _ |
how can done? how have use "layout_weight" "layout_width" property? have use "wrap_content"? , why? can done tableview??
thank in advance
check example use weight, when use weight width must 0dp:
<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:weightsum="5"> <textview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="1" /> <textview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="3" android:text="2" /> <textview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="3" /> </linearlayout>
Comments
Post a Comment