Project

General

Profile

« Previous | Next » 

Revision 43162dfb

Added by Leszek Koltunski over 3 years ago

Correctly centralize the buttons on the main menu popup.

View differences:

src/main/java/org/distorted/states/RubikStatePlay.java
322 322
    mMenuLayoutWidth = (int)(width/2);
323 323
    mMenuLayoutHeight= (int)(2*margin + NUM_BUTTONS*(mMenuItemSize+margin));
324 324

  
325
    LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
326
    pT.setMargins(margin, 0, margin, margin);
327
    LinearLayout.LayoutParams pM = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
328
    pM.setMargins(margin, margin, margin, margin);
329
    LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
330
    pB.setMargins(margin, margin, margin, 2*margin);
325
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
331 326

  
332 327
    for(int i=0; i<NUM_BUTTONS; i++)
333 328
      {
334 329
      final int but = i;
335 330
      Button button = new Button(act);
336
      button.setLayoutParams(pT);
331
      button.setLayoutParams(p);
337 332
      button.setText(BUTTON_LABELS[i]);
338 333
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
339 334

  
src/main/res/layout/popup_menu.xml
3 3
   android:id="@+id/menuGrid"
4 4
   android:layout_width="wrap_content"
5 5
   android:layout_height="wrap_content"
6
   android:gravity="center"
6 7
   android:orientation="vertical">
7 8
</LinearLayout>

Also available in: Unified diff