Home > Mobile > Multiple round button lined up, for advice
Multiple round button lined up, for advice
Time:11-18
Wanted to be an interface to do graphic button, each line, four row 7 lines, average each column in each row, as shown in figure 1, but now the circle line button will be stretched, as shown in figure 2 Great god guidance, can be in any size interface circular button, and the average alignment, spacing as The enclosed code:
Main code: Public class MainActivity extends AppCompatActivity {
Private static String [] irButtonName={ "CH1 and CH2," "ON", "LOCK", "10", "50", "OFF", "AUTO", "100", "300", "SENS +", "TEST", "500", "1000", "SENS SemiAuto", ""," 2000 ", "24 h", "EYE", "PULSE", "30 s", "1 m", "3 m", "5 m", "10 m, 20 m", "30 m", "60 m "}; Private LinearLayout contentView.//declare a reference layout file Private View. An OnClickListener btnOnClick;//declare the button to monitor reference @ Override Protected void onCreate (Bundle savedInstanceState) { Super. OnCreate (savedInstanceState); The setContentView (R.l ayout. Content_main); ContentView=(LinearLayout) the findViewById (R.i, dc ontentView); Enclosing initView (contentView); } Public void initView (LinearLayout parentLL) { //LinearLayout parentLL=(LinearLayout) contentView; Int size=irButtonName. Length; LinearLayout. LayoutParams LayoutParams=new LinearLayout. LayoutParams (LinearLayout. LayoutParams. WRAP_CONTENT, LinearLayout. LayoutParams. WRAP_CONTENT);//each row of the parameters of the horizontal LinearLayout
,23,10,23 layoutParams. The setMargins (10); ArrayList