android - Maximize the button in a gridlayout -


i have activity:

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.gridlayout xmlns:android="http://schemas.android.com/apk/res/android"                                   xmlns:app="http://schemas.android.com/apk/res-auto"                                   android:layout_width="match_parent"                                   android:layout_height="match_parent"                                   app:rowcount="4"                                   app:columncount="4">  <button     android:text="1"     android:id="@+id/button1"     app:layout_gravity="fill"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_row="0"     app:layout_column="0""/>   <button     android:text="2"     android:id="@+id/button2"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_gravity="fill"     app:layout_row="0"     app:layout_column="1"/>  <button     android:text="3"     android:id="@+id/button3"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_gravity="fill"     app:layout_row="0"     app:layout_column="2"/>  <button     android:text="4"     android:id="@+id/button5"      app:layout_gravity="fill"     app:layout_row="1"     app:layout_column="0"/>  <button     android:text="5"     android:id="@+id/button6"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_gravity="fill"     app:layout_row="1"     app:layout_column="1"/>  <button     android:text="6"     android:id="@+id/button7"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_gravity="fill"     app:layout_row="1"     app:layout_column="2"/> <button     android:text="7"     android:id="@+id/button8"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_gravity="fill"     app:layout_row="2"     app:layout_column="0"/> <button     android:text="8"     android:id="@+id/button9"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_gravity="fill"     app:layout_row="2"     app:layout_column="1"/>  <button     android:text="9"     android:id="@+id/button4"     app:layout_gravity="fill"     app:layout_rowweight="1"     app:layout_columnweight="1"     app:layout_row="2"     app:layout_column="2"     /> 

which looks this:

current layout

i change button 1, stratched vertically , 4 , 7 must minimized wrap_contnet (made in photoshop) enter image description here

what best way this?

more specifically, need make this:

enter image description here

i made using custom width, don't know how make using layouts:

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.gridlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:grid="http://schemas.android.com/apk/res-auto" tools:context="com.example.win72.myapplication.mainactivity" grid:columncount="3" grid:rowcount="3">   <textview     grid:layout_gravity="fill"     grid:layout_columnweight="1"     grid:layout_rowweight="10"     grid:layout_row="0"     grid:layout_column="0"     grid:layout_rowspan="2"      android:textsize="60sp"     android:background="#a49595"     android:text="90"     android:id="@+id/textview"     android:clickable="true"     android:layout_height="457dp"/>  <textview     grid:layout_gravity="fill"     grid:layout_columnweight="1"     grid:layout_rowweight="10"     grid:layout_row="0"     grid:layout_column="2"     grid:layout_rowspan="2"      android:textsize="60sp"     android:background="#a49595"     android:text="90"     android:id="@+id/textview2"/>  <textview    grid:layout_row="2"    grid:layout_column="0"    grid:layout_gravity="fill_horizontal"    grid:layout_columnweight="1"     android:gravity="center"    android:textsize="30sp"    android:text="4"    android:id="@+id/textview3"/>  <textview     grid:layout_row="2"     grid:layout_column="2"     grid:layout_gravity="fill_horizontal"       android:text="6"     android:id="@+id/textview4"     android:gravity="center"     android:textsize="30sp"     />  <button     grid:layout_row="0"     grid:layout_column="1"     grid:layout_columnweight="1"     grid:layout_gravity="fill_horizontal"     android:text="reset"     android:id="@+id/button"/>  <button     grid:layout_row="1"     grid:layout_column="1"     grid:columnweight="1"     grid:layout_gravity="fill_horizontal"      android:text="next"     android:id="@+id/button2"     /> 

using staggeredgridlayout can achieve that.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -