第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

正在回答

2 回答

講的無法運(yùn)行

0 回復(fù) 有任何疑惑可以回復(fù)我~
//下拉View
public?class?PullDownView?extends?View?{

????private?float?mProgress;
????Paint?mCirclePaint;
????private?int?mCircleRadius?=?150;
????private?int?mCircleRadiuX,?mCircleRadiuY;

????//可拖動(dòng)的高度
????private?int?mDragHeight?=?800;

????public?PullDownView(Context?context)?{
????????super(context);
????????init();
????}

????public?PullDownView(Context?context,?@Nullable?AttributeSet?attrs)?{
????????super(context,?attrs);
????????init();
????}

????public?PullDownView(Context?context,?@Nullable?AttributeSet?attrs,?int?defStyleAttr)?{
????????super(context,?attrs,?defStyleAttr);
????????init();
????}
????@RequiresApi(api?=?Build.VERSION_CODES.LOLLIPOP)
????public?PullDownView(Context?context,?@Nullable?AttributeSet?attrs,?int?defStyleAttr,?int?defStyleRes)?{
????????super(context,?attrs,?defStyleAttr,?defStyleRes);
????}

????private?void?init()?{

????????Paint?paint?=?new?Paint(Paint.ANTI_ALIAS_FLAG);
????????//設(shè)置抗鋸齒
????????paint.setAntiAlias(true);
????????//設(shè)置防抖
????????paint.setDither(true);
????????//設(shè)置填充方式
????????paint.setStyle(Paint.Style.FILL);
????????paint.setColor(0xff000000);
????????mCirclePaint?=?paint;
????}

????@Override
????protected?void?onDraw(Canvas?canvas)?{
????????super.onDraw(canvas);

????????canvas.drawCircle(mCircleRadiuX,?mCircleRadiuY,?mCircleRadius,?mCirclePaint);
????}

????@Override
????protected?void?onMeasure(int?widthMeasureSpec,?int?heightMeasureSpec)?{
//????????super.onMeasure(widthMeasureSpec,?heightMeasureSpec);
????????int?widthMode?=?MeasureSpec.getMode(widthMeasureSpec);
????????int?width?=?MeasureSpec.getSize(widthMeasureSpec);

????????int?heightMode?=?MeasureSpec.getMode(heightMeasureSpec);
????????int?height?=?MeasureSpec.getSize(heightMeasureSpec);

????????int?minWidth?=?2*mCircleRadius+getPaddingLeft()+getPaddingRight();
????????int?minHeight?=?(int)?((mDragHeight*mProgress?+0.5f)+getPaddingTop()+getPaddingBottom());

????????int?measureWidth,?measureHeight;

????????if?(widthMode?==?MeasureSpec.EXACTLY){
????????????//確定的值
????????????measureWidth?=?width;
????????}?else?if?(widthMode?==?MeasureSpec.AT_MOST){
????????????//最多的值
????????????measureWidth?=?Math.min(minWidth,?width);
????????}?else?{
????????????measureWidth?=?minWidth;
????????}

????????if?(heightMode?==?MeasureSpec.EXACTLY){
????????????//確定的值
????????????measureHeight?=?height;
????????}?else?if?(heightMode?==?MeasureSpec.AT_MOST){
????????????//最多的值
????????????measureHeight?=?Math.min(minHeight,?height);
????????}?else?{
????????????measureHeight?=?minHeight;
????????}
????????//設(shè)置寬高
????????setMeasuredDimension(measureWidth,?measureHeight);

????}

????@Override
????protected?void?onSizeChanged(int?w,?int?h,?int?oldw,?int?oldh)?{
????????super.onSizeChanged(w,?h,?oldw,?oldh);
????????mCircleRadiuX?=?getWidth()>>1;
????????mCircleRadiuY?=?getHeight()>>1;
????}

????/**
?????*?設(shè)置拖動(dòng)進(jìn)度
?????*?@param?progress
?????*/
????public?void?setProgress(float?progress){
????????Log.e("TAG",?"p"+progress);
????????mProgress?=?progress;
????????requestLayout();
????}
}

//RelativeLayout下拉監(jiān)聽
final?PullDownView?pullDownView?=?findViewById(R.id.pulldown);

findViewById(R.id.activity_main).setOnTouchListener(new?View.OnTouchListener()?{
????@Override
????public?boolean?onTouch(View?view,?MotionEvent?motionEvent)?{
????????int?action?=?motionEvent.getAction();
????????switch?(action){
????????????case?MotionEvent.ACTION_DOWN:
????????????????mTouchMoveStartY?=?motionEvent.getY();
????????????????return?true;
????????????case?MotionEvent.ACTION_MOVE:
????????????????float?y?=?motionEvent.getY();
????????????????if?(y>=mTouchMoveStartY){
????????????????????float?moveSize?=?y?-?mTouchMoveStartY;
????????????????????float?progress?=?moveSize>=?TOUCH_MOVE_MAX_Y??1:?moveSize/TOUCH_MOVE_MAX_Y;
????????????????????pullDownView.setProgress(progress);
????????????????}
????????????????return?true;
????????????case?MotionEvent.ACTION_UP:
????????????????break;
????????}

????????return?false;
????}
});

//Xml
<?xml?version="1.0"?encoding="utf-8"?>
<RelativeLayout?xmlns:android="http://schemas.android.com/apk/res/android"
????xmlns:top="http://schemas.android.com/apk/res-auto"
????android:id="@+id/activity_main"
????android:layout_width="match_parent"
????android:layout_height="match_parent"
????android:background="#fff">

????<com.summer.h5.View.PullDownView
????????android:id="@+id/pulldown"
????????android:layout_width="match_parent"
????????android:layout_height="wrap_content"/>

</RelativeLayout>


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

拉不動(dòng)怎么辦

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)