How to set no height for a widget in Android Studio? -


i learning android development , i'm trying make simple calculator. having problems layout of calculator. in opinion, clunky post whole xml code, i'm going post snippets matter in opinion.

i made vertical linearlayout top-most parent, has 2 children, horizontal linearlayout, (which consists of textview shows input , button tells calculate) , gridlayout, 0-9 buttons , operators.

the problem is, grid layout 4x4 grid buttons , when want set first row of buttons, each button needs layout_height, can't left empty , if set it's value match_parent, button alone fill whole screen.

so how can solve problem layout_height, there workaround or better make multiple linearlayouts grid? if have additional questions, feel free ask can explain.

here children linearlayout , gridlayout xml code:

<linearlayout     android:layout_width="match_parent"     android:layout_height="60dp"     android:layout_weight="1"     android:background="@color/colorlight"     android:orientation="horizontal">  <gridlayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_weight="8"     android:background="@color/colorlight"     android:> 

sorry, misunderstand question. if use api 21 or newer, can use columncount it.

please refer that answer or that answer


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -