c# - Problems with gridlayout with buttons in Android -
i wondering how format buttons show on screen instead of going off it? have 10x10 grid , want them compressed no spacing in-between. i'm writing in visual studios xamarin.
protected override void oncreate(bundle bundle) { base.oncreate(bundle); setcontentview(resource.layout.main); gridlayout gl = (gridlayout)findviewbyid(resource.id.gridlayout1); // set our view "main" layout resource button[] cells = new button[99]; var = 0; foreach (button b in cells) { cells[i] = new button(this); gl.addview(cells[i]); i++; } }} <?xml version="1.0" encoding="utf-8"?> <gridlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/gridlayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:columncount="10" android:rowcount="10" android:orientation="horizontal" tools:context=".gridxmlactivity" /> using system; using android.app; using android.content; using android.runtime; using android.views; using android.widget; using android.os; namespace app3 { [activity(label = "app3", mainlauncher = true, icon = "@drawable/icon")] public class mainactivity : activity {
what i'm getting right now. http://i.stack.imgur.com/zkbjf.png
try using horizontal scroll view shown below might you:
<horizontalscrollview android:layout_width="match_parent" android:layout_height="match_parent"> <!-- content here --> </horizontalscrollview>
Comments
Post a Comment