android - How GridLayout works when specifying the columnspan and rowspan -
i have made layout desing listview in android project. it's that;
i have read , researched on other gridlayout samples , have written xml in accordance have got.
<?xml version="1.0" encoding="utf-8"?> <gridlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/card_background" android:columncount="30" android:orientation="horizontal" android:rowcount="6" android:id="@+id/grid_layout_notification"> <com.ei.dizitakip.android.circlednetworkimageview android:id="@+id/fancy_notification_thumbnail" android:layout_columnspan="5" android:layout_rowspan="6" /> <textview android:layout_columnspan="25" android:textappearance="?android:attr/textappearancelarge" android:id="@+id/fancy_title" android:textcolor="@color/color_primary_dark" /> <imageview android:layout_columnspan="2" android:id="@+id/fancy_season_icon" android:src="@mipmap/season_icon" android:background="@android:color/transparent" /> <textview android:layout_columnspan="10" android:id="@+id/fancy_status_text" android:gravity="center_vertical" /> <imageview android:layout_columnspan="2" android:id="@+id/fancy_domain_icon" android:src="@mipmap/www_icon" android:background="@android:color/transparent" /> <textview android:layout_columnspan="11" android:id="@+id/fancy_domain_text" android:gravity="center_vertical" /> </gridlayout>
as have realized code far design. missing gridlayouts? first time have been used , used same approach linearlayout's layout_weight. appreciated code samples, approach or technique.
you should use android:layout_gravity specify size of grid. example android developers blog
to achieve design;
code;
<?xml version="1.0" encoding="utf-8"?> <gridlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:usedefaultmargins="true" android:alignmentmode="alignbounds" android:columnorderpreserved="false" android:columncount="4" > <textview android:text="email setup" android:textsize="32dip" android:layout_columnspan="4" android:layout_gravity="center_horizontal" /> <textview android:text="you can configure email in few steps:" android:textsize="16dip" android:layout_columnspan="4" android:layout_gravity="left" /> <textview android:text="email address:" android:layout_gravity="right" /> <edittext android:ems="10" /> <textview android:text="password:" android:layout_column="0" android:layout_gravity="right" /> <edittext android:ems="8" /> <space android:layout_row="4" android:layout_column="0" android:layout_columnspan="3" android:layout_gravity="fill" /> <button android:text="next" android:layout_row="5" android:layout_column="3" /> </gridlayout>
you need use <space>
tag achieve design.
Comments
Post a Comment