Skip to content

Commit

Permalink
修复了文字显示不全的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyKitkat committed Sep 22, 2020
1 parent 46b8140 commit f010e2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/b502/minedroid/utils/MapItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public void setButtonState(MapItem.State state) {
this.viewButton.setText("");
Drawable drawable = ContextCompat.getDrawable(this.getViewButton().getContext(), androidx.appcompat.R.drawable.abc_btn_colored_material);
this.viewButton.setBackground(drawable);
int tmp = this.viewButton.getCompoundDrawablePadding()+15;
this.viewButton.setPadding(tmp, tmp, tmp, tmp);
} else if (state == MapItem.State.FLAGED) {
this.viewButton.setText("标");
} else if (state == MapItem.State.OPENED) {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/b502/minedroid/utils/MapManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,10 @@ void generateButtons() {

for (int i = 1; i <= width; i++) {
AppCompatButton b = new AppCompatButton(context);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(getPixelsFromDp(buttonwidth), getPixelsFromDp(buttonwidth + 5));
lp.setMargins(-6, -6, 0, 0);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(getPixelsFromDp(buttonwidth - 2), getPixelsFromDp(buttonwidth + 3));
b.setLayoutParams(lp);
b.setTag(new int[]{i, j});
b.setPadding(1, 1, 1, 1);
//b.setPadding(1, 1, 1, 1);
// if (map[i][j].isMine)b.setText("雷");
// else b.setText(Integer.toString(map[i][j].getMineCount()));
b.setOnClickListener(new View.OnClickListener() {
Expand Down

0 comments on commit f010e2a

Please sign in to comment.