user interface - Android UI: what kind of layout options are mutually exclusive? -


after designing layouts in android while now, still cannot hang of it. results unpredictable.

i think part of boils down layout options not working together. i.e. if using 1 way of specifying layout, you're not meant use other way.

notably, me, changing layout_width fill_parent wrap_content changes world. let me give specific example:

part of activity's layout linearlayout:

    <linearlayout android:id="@+id/ll2" android:layout_width="fill_parent"         android:layout_height="wrap_content" android:orientation="horizontal">         <linearlayout android:id="@+id/ll2a" android:layout_width="fill_parent"             android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1">             <textview android:id="@+id/l_cover" android:layout_width="wrap_content"                 android:layout_height="wrap_content" android:text="@string/book_item_l_cover">             </textview>             <imagebutton android:id="@+id/i_cover"                 android:layout_width="wrap_content" android:layout_height="wrap_content"                 android:scaletype="centerinside" android:gravity="center"                 android:layout_weight="1" android:adjustviewbounds="true"                 android:src="@drawable/spinner_black_76" android:minwidth="400dip">             </imagebutton>         </linearlayout>         <linearlayout android:id="@+id/ll2b" android:layout_width="fill_parent"             android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1">             <textview android:id="@+id/l_back_cover" android:layout_width="wrap_content"                 android:layout_height="wrap_content" android:text="@string/book_item_l_back_cover">             </textview>             <imagebutton android:id="@+id/i_back_cover"                 android:layout_width="wrap_content" android:layout_height="wrap_content"                 android:scaletype="centerinside" android:gravity="center"                 android:layout_weight="1" android:adjustviewbounds="true"                 android:src="@drawable/spinner_black_76">             </imagebutton>         </linearlayout>     </linearlayout> 

to 2 columns of left-aligning label-button combinations next eachother had use layout_weight attributes. imagebuttons shrink around images due adjustviewbounds attributes. gets me pretty result.

now wanted have buttons of minimum size finger can press them, when not contain image (and shrink few millimeters). experimented setting android:minwidth="400dip" can see. expected button fill entire half of screen in width (400 quite large value), i'm not seeing difference.

i guess 1 of other attributes above preventing minwidth having impact. , go experiment , disable others see gives me. question here is: does have (logical) information on attribute prevents or counter-intuitively influences whichother? i'd sorted once , all. documented somewhere?

i've noticed layout_weight seems render minwidth useless.

given 3 buttons in linear layout, weight of left , right 0, , center 1, changing minwidth of of these has absolutely no effect on way view rendered, until remove layout_weight attributes entirely each button. made sure sum of minwidths less total view's width.

i have no idea why case. documentation regarding layout_weight:

this attribute assigns "importance" value view, , allows expand fill remaining space in parent view. child views can specify integer weight value, , remaining space in view group assigned children in proportion of declared weight

i'd love know other layout parameters conflict each other. seems unintuitive me defining weight view fill "remaining space in parent view" disregard view's minwidth settings.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -