I want to make a grid of buttons for my Android app. I did a traditional experiment for loop to make it, which usually works in other languages. But when I check my app, it does not respond when the page loads and closes. How can I decide ...
but = new button [4] [4]; LinearLayout = (ViewGyAd) ViewById (R.id.buttonlayout); (Int r = 0; r & lt; but.length; r ++) {for (int c = 0; c & lt; but.length; c ++) {but [r] [c] .setLayoutParams (New LinearLayout.LayoutParams (20, 20)); But [R] [C] = new button (this); But [R] [C]. STX (20 * R); But [R] [C]. Set (20 * C); But [R] [C] .set text (""); LinearLayout.addView (but [R] [C]); }}
but = new button [4] [4]; LinearLayout = (ViewGyAd) ViewById (R.id.buttonlayout); (Int r = 0; r & lt; but.length; r ++) for {for (int c = 0; c & lt; but.length; c ++) {but [r] [c] = new Button (this); // You must make your object before the set object! But [R] [C]. Seattle layout at the bottom (New liner layout. LayoutParam (20, 20)); But [R] [C]. STX (20 * R); But [R] [C]. Set (20 * C); But [R] [C] .set text (""); LinearLayout.addView (but [R] [C]);
No comments:
Post a Comment