Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 78f4c6d

Browse files
delldell
dell
authored and
dell
committed
10.25
1 parent 593538b commit 78f4c6d

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

‎.idea/modules.xml‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@
5050
Toast.makeText(this,"关",Toast.LENGTH_SHORT).show();
5151
}
5252
}
53+
54+
55+
4:如何调整控件的高度?
56+
![Aaron Swartz]()

‎app/src/main/java/com/xie/brad/myswitchbutton/MyButton/SwitchButton.java‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import android.content.Context;
44
import android.content.res.TypedArray;
5-
import android.graphics.Bitmap;
65
import android.graphics.Canvas;
76
import android.graphics.Paint;
87
import android.graphics.Path;
@@ -22,25 +21,16 @@
2221
public class SwitchButton extends View {
2322

2423

25-
private Bitmap switchButton;
26-
private Bitmap switchCloseBG;
27-
private Bitmap switchOpenBG;
28-
private int bgWitch;
29-
private int buttonWitch;
30-
private int height;
3124
private Paint paint;
3225
private float downX;
3326
private float moveX;
3427
private float BTmoveX;
3528
private float dx;
3629
private float maxX;
3730
private boolean isOpen;
38-
private float paintWith;
3931
private Date date;
4032
private long downTime;
4133
private long upTime;
42-
private int widthMeasureSpec;
43-
private int heightMeasureSpec;
4434
private int mWidth;
4535
private int mHeight;
4636
private int sRight;
@@ -83,7 +73,7 @@ public SwitchButton(Context context, AttributeSet attrs, int defStyleAttr) {
8373
}
8474

8575

86-
//自己确定大小~ 截图量了一下 算上阴影宽高比例是 149:92 。即 height = width * 0.65 左右
76+
// height = width * 0.65 左右
8777
@Override
8878
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
8979
super.onMeasure(widthMeasureSpec, heightMeasureSpec);

‎switchbt_hight.png‎

24.7 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /