Android TableLayout in LinearLayout - Remove spaces in between columns and rows -
i struggle more ui design in android making application, giving go:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <tablelayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <tablerow android:id="@+id/rowone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > <button android:id="@+id/bone" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/btwo" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/bthree" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/bfour" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> </tablerow> <tablerow android:id="@+id/rowtwo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > <button android:id="@+id/bfive" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/bsix" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/bseven" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/beight" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> </tablerow> <tablerow android:id="@+id/rowthree" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > <button android:id="@+id/bnine" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/bten" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/beleven" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> <button android:id="@+id/btwelve" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" /> </tablerow> </tablelayout> </linearlayout>
i have been trying remove spaces in between rows , columns, tried giving negative margin rows , buttons so:
android:layout_marginright="-20sp"
but "fiddly" not accurate , don't think scale same screens (correct me if wrong). through giving rows layout_weight attributes of 1 make them cover entire width of screen (i know weight importance given element). perhaps need use stretchcolumns? or perhaps there tag might useful here?
the reson have put in linearlayout because plan add other elements , experiment well.
replace buttons :
<button android:id="@+id/bfour" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="button" />
with
<button android:id="@+id/bfour" android:layout_height="fill_parent" android:layout_width="0dp" android:layout_weight="1" android:text="button" />
Comments
Post a Comment