一看就喜歡的loading動(dòng)畫效果Android分析實(shí)現(xiàn)
還是比較有新意,復(fù)雜度也不是非常高,所以就花時(shí)間整理一下,我們先一起看下原gif圖效果:
從效果上看,我們需要考慮以下幾個(gè)問題:
- 1.葉子的隨機(jī)產(chǎn)生;
- 2.葉子隨著一條正余弦曲線移動(dòng);
- 3.葉子在移動(dòng)的時(shí)候旋轉(zhuǎn),旋轉(zhuǎn)方向隨機(jī),正時(shí)針或逆時(shí)針;
- 4.葉子遇到進(jìn)度條,似乎是融合進(jìn)入;
- 5.葉子不能超出最左邊的弧角;
- 7.葉子飄出時(shí)的角度不是一致,走的曲線的振幅也有差別,否則太有規(guī)律性,缺乏美感;
總的看起來,需要注意和麻煩的地方主要是以上幾點(diǎn),當(dāng)然還有一些細(xì)節(jié)問題,比如最左邊是圓弧等等;
那接下來我們將效果進(jìn)行分解,然后逐個(gè)擊破:
整個(gè)效果來說,我們需要的圖主要是飛動(dòng)的小葉子和右邊旋轉(zhuǎn)的風(fēng)扇,其他的部分都可以用色值進(jìn)行繪制,當(dāng)然我們?yōu)榱朔奖?,就連底部框一起切了;
先從gif 圖里把飛動(dòng)的小葉子和右邊旋轉(zhuǎn)的風(fēng)扇、底部框摳出來,小葉子圖如下:
我們需要處理的主要有兩個(gè)部分:
- 1. 隨著進(jìn)度往前繪制的進(jìn)度條;
- 2. 不斷飛出來的小葉片;
我們先處理第一部分 - 隨著進(jìn)度往前繪制的進(jìn)度條:
進(jìn)度條的位置根據(jù)外層傳入的 progress 進(jìn)行計(jì)算,可以分為圖中 1、2、3 三個(gè)階段:
- 1. 當(dāng)progress 較小,算出的當(dāng)前距離還在弧形以內(nèi)時(shí),需要繪制如圖所示 1 區(qū)域的弧形,其余部分用白色填充;
- 2. 當(dāng) progress 算出的距離到2時(shí),需要繪制棕色半圓弧形,其余部分用白色矩形填充;
- 3. 當(dāng) progress 算出的距離到3 時(shí),需要繪制棕色半圓弧形,棕色矩形,白色矩形;
- 4. 當(dāng) progress 算出的距離到頭時(shí),需要繪制棕色半圓弧形,棕色矩形;(可以合并到3中)
首先根據(jù)進(jìn)度條的寬度和當(dāng)前進(jìn)度、總進(jìn)度算出當(dāng)前的位置:
//mProgressWidth為進(jìn)度條的寬度,根據(jù)當(dāng)前進(jìn)度算出進(jìn)度條的位置 mCurrentProgressPosition = mProgressWidth * mProgress / TOTAL_PROGRESS;
然后按照上面的邏輯進(jìn)行繪制,其中需要計(jì)算上圖中的紅色弧角角度,計(jì)算方法如下:
// 單邊角度 int angle = (int) Math.toDegrees(Math.acos((mArcRadius - mCurrentProgressPosition)/ (float) mArcRadius));
Math.acos() -反余弦函數(shù);
Math.toDegrees() - 弧度轉(zhuǎn)化為角度,Math.toRadians 角度轉(zhuǎn)化為弧度
所以圓弧的起始點(diǎn)為:
int startAngle = 180 - angle;
圓弧劃過的角度為:
2 * angle
這一塊的代碼如下:
// mProgressWidth為進(jìn)度條的寬度,根據(jù)當(dāng)前進(jìn)度算出進(jìn)度條的位置 mCurrentProgressPosition = mProgressWidth * mProgress / TOTAL_PROGRESS; // 即當(dāng)前位置在圖中所示1范圍內(nèi) if (mCurrentProgressPosition < mArcRadius) { Log.i(TAG, "mProgress = " + mProgress + "---mCurrentProgressPosition = " + mCurrentProgressPosition + "--mArcProgressWidth" + mArcRadius); // 1.繪制白色ARC,繪制orange ARC // 2.繪制白色矩形 // 1.繪制白色ARC canvas.drawArc(mArcRectF, 90, 180, false, mWhitePaint); // 2.繪制白色矩形 mWhiteRectF.left = mArcRightLocation; canvas.drawRect(mWhiteRectF, mWhitePaint); // 3.繪制棕色 ARC // 單邊角度 int angle = (int) Math.toDegrees(Math.acos((mArcRadius - mCurrentProgressPosition) / (float) mArcRadius)); // 起始的位置 int startAngle = 180 - angle; // 掃過的角度 int sweepAngle = 2 * angle; Log.i(TAG, "startAngle = " + startAngle); canvas.drawArc(mArcRectF, startAngle, sweepAngle, false, mOrangePaint); } else { Log.i(TAG, "mProgress = " + mProgress + "---transfer-----mCurrentProgressPosition = " + mCurrentProgressPosition + "--mArcProgressWidth" + mArcRadius); // 1.繪制white RECT // 2.繪制Orange ARC // 3.繪制orange RECT // 1.繪制white RECT mWhiteRectF.left = mCurrentProgressPosition; canvas.drawRect(mWhiteRectF, mWhitePaint); // 2.繪制Orange ARC canvas.drawArc(mArcRectF, 90, 180, false, mOrangePaint); // 3.繪制orange RECT mOrangeRectF.left = mArcRightLocation; mOrangeRectF.right = mCurrentProgressPosition; canvas.drawRect(mOrangeRectF, mOrangePaint); }
接下來再來看葉子部分:
首先根據(jù)效果情況基本確定出 曲線函數(shù),標(biāo)準(zhǔn)函數(shù)方程為:y = A(wx+Q)+h,其中w影響周期,A影響振幅 ,周期T= 2 * Math.PI/w;
根據(jù)效果可以看出,周期大致為總進(jìn)度長(zhǎng)度,所以確定w=(float) ((float) 2 * Math.PI /mProgressWidth);
仔細(xì)觀察效果,我們可以發(fā)現(xiàn),葉子飄動(dòng)的過程中振幅不是完全一致的,產(chǎn)生一種錯(cuò)落的效果,既然如此,我們給葉子定義一個(gè)Type,根據(jù)Type 確定不同的振幅;
我們創(chuàng)建一個(gè)葉子對(duì)象:
private class Leaf { // 在繪制部分的位置 float x, y; // 控制葉子飄動(dòng)的幅度 StartType type; // 旋轉(zhuǎn)角度 int rotateAngle; // 旋轉(zhuǎn)方向--0代表順時(shí)針,1代表逆時(shí)針 int rotateDirection; // 起始時(shí)間(ms) long startTime; }
類型采用枚舉進(jìn)行定義,其實(shí)就是用來區(qū)分不同的振幅:
private enum StartType { LITTLE, MIDDLE, BIG }
創(chuàng)建一個(gè)LeafFactory類用于創(chuàng)建一個(gè)或多個(gè)葉子信息:
private class LeafFactory { private static final int MAX_LEAFS = 6; Random random = new Random(); // 生成一個(gè)葉子信息 public Leaf generateLeaf() { Leaf leaf = new Leaf(); int randomType = random.nextInt(3); // 隨時(shí)類型- 隨機(jī)振幅 StartType type = StartType.MIDDLE; switch (randomType) { case 0: break; case 1: type = StartType.LITTLE; break; case 2: type = StartType.BIG; break; default: break; } leaf.type = type; // 隨機(jī)起始的旋轉(zhuǎn)角度 leaf.rotateAngle = random.nextInt(360); // 隨機(jī)旋轉(zhuǎn)方向(順時(shí)針或逆時(shí)針) leaf.rotateDirection = random.nextInt(2); // 為了產(chǎn)生交錯(cuò)的感覺,讓開始的時(shí)間有一定的隨機(jī)性 mAddTime += random.nextInt((int) (LEAF_FLOAT_TIME * 1.5)); leaf.startTime = System.currentTimeMillis() + mAddTime; return leaf; } // 根據(jù)最大葉子數(shù)產(chǎn)生葉子信息 public List<Leaf> generateLeafs() { return generateLeafs(MAX_LEAFS); } // 根據(jù)傳入的葉子數(shù)量產(chǎn)生葉子信息 public List<Leaf> generateLeafs(int leafSize) { List<Leaf> leafs = new LinkedList<Leaf>(); for (int i = 0; i < leafSize; i++) { leafs.add(generateLeaf()); } return leafs; } }
定義兩個(gè)常亮分別記錄中等振幅和之間的振幅差:
// 中等振幅大小 private static final int MIDDLE_AMPLITUDE = 13; // 不同類型之間的振幅差距 private static final int AMPLITUDE_DISPARITY = 5; [html] view plain copy 在CODE上查看代碼片派生到我的代碼片 // 中等振幅大小 private int mMiddleAmplitude = MIDDLE_AMPLITUDE; // 振幅差 private int mAmplitudeDisparity = AMPLITUDE_DISPARITY;
有了以上信息,我們則可以獲取到葉子的Y值:
// 通過葉子信息獲取當(dāng)前葉子的Y值 private int getLocationY(Leaf leaf) { // y = A(wx+Q)+h float w = (float) ((float) 2 * Math.PI / mProgressWidth); float a = mMiddleAmplitude; switch (leaf.type) { case LITTLE: // 小振幅 = 中等振幅 - 振幅差 a = mMiddleAmplitude - mAmplitudeDisparity; break; case MIDDLE: a = mMiddleAmplitude; break; case BIG: // 小振幅 = 中等振幅 + 振幅差 a = mMiddleAmplitude + mAmplitudeDisparity; break; default: break; } Log.i(TAG, "---a = " + a + "---w = " + w + "--leaf.x = " + leaf.x); return (int) (a * Math.sin(w * leaf.x)) + mArcRadius * 2 / 3; }
接下來,我們開始繪制葉子:
/** * 繪制葉子 * * @param canvas */ private void drawLeafs(Canvas canvas) { long currentTime = System.currentTimeMillis(); for (int i = 0; i < mLeafInfos.size(); i++) { Leaf leaf = mLeafInfos.get(i); if (currentTime > leaf.startTime && leaf.startTime != 0) { // 繪制葉子--根據(jù)葉子的類型和當(dāng)前時(shí)間得出葉子的(x,y) getLeafLocation(leaf, currentTime); // 根據(jù)時(shí)間計(jì)算旋轉(zhuǎn)角度 canvas.save(); // 通過Matrix控制葉子旋轉(zhuǎn) Matrix matrix = new Matrix(); float transX = mLeftMargin + leaf.x; float transY = mLeftMargin + leaf.y; Log.i(TAG, "left.x = " + leaf.x + "--leaf.y=" + leaf.y); matrix.postTranslate(transX, transY); // 通過時(shí)間關(guān)聯(lián)旋轉(zhuǎn)角度,則可以直接通過修改LEAF_ROTATE_TIME調(diào)節(jié)葉子旋轉(zhuǎn)快慢 float rotateFraction = ((currentTime - leaf.startTime) % LEAF_ROTATE_TIME) / (float) LEAF_ROTATE_TIME; int angle = (int) (rotateFraction * 360); // 根據(jù)葉子旋轉(zhuǎn)方向確定葉子旋轉(zhuǎn)角度 int rotate = leaf.rotateDirection == 0 ? angle + leaf.rotateAngle : -angle + leaf.rotateAngle; matrix.postRotate(rotate, transX + mLeafWidth / 2, transY + mLeafHeight / 2); canvas.drawBitmap(mLeafBitmap, matrix, mBitmapPaint); canvas.restore(); } else { continue; } } }
最后,向外層暴露幾個(gè)接口:
/** * 設(shè)置中等振幅 * * @param amplitude */ public void setMiddleAmplitude(int amplitude) { this.mMiddleAmplitude = amplitude; } /** * 設(shè)置振幅差 * * @param disparity */ public void setMplitudeDisparity(int disparity) { this.mAmplitudeDisparity = disparity; } /** * 獲取中等振幅 * * @param amplitude */ public int getMiddleAmplitude() { return mMiddleAmplitude; } /** * 獲取振幅差 * * @param disparity */ public int getMplitudeDisparity() { return mAmplitudeDisparity; } /** * 設(shè)置進(jìn)度 * * @param progress */ public void setProgress(int progress) { this.mProgress = progress; postInvalidate(); } /** * 設(shè)置葉子飄完一個(gè)周期所花的時(shí)間 * * @param time */ public void setLeafFloatTime(long time) { this.mLeafFloatTime = time; } /** * 設(shè)置葉子旋轉(zhuǎn)一周所花的時(shí)間 * * @param time */ public void setLeafRotateTime(long time) { this.mLeafRotateTime = time;
這些接口用來干嘛呢?用于把我們的動(dòng)效做成完全可手動(dòng)調(diào)節(jié)的,這樣做有什么好處呢?
1. 更加便于產(chǎn)品、射雞濕查看效果,避免YY,自己手動(dòng)調(diào)節(jié),不會(huì)出現(xiàn)要你一遍遍的改參數(shù)安裝、查看、再改、再查看... ... N遍之后說 “這好像不是我想要的” -- 瞬間天崩地裂,天昏地暗,感覺被全世界拋棄;
2. 便于體現(xiàn)你是一個(gè)考慮全面,思維縝密,會(huì)編程、會(huì)設(shè)計(jì)的藝術(shù)家,當(dāng)然這純屬YY,主要還是方便大家;
如此一來,射雞濕們只需要不斷的調(diào)節(jié)即可實(shí)時(shí)的看到展現(xiàn)的效果,最后只需要把最終的參數(shù)反饋過來即可,萬事大吉,一了百了;
當(dāng)然,如果對(duì)方是個(gè)漂亮的妹子,而你又苦于沒有機(jī)會(huì)搭訕,以上內(nèi)容就當(dāng)我沒說,盡情的不按要求寫吧,她肯定會(huì)主動(dòng)找你的,說不定連飯都反過來請(qǐng)了... ...
好啦,言歸正傳,完成收尾部分,我們讓所有的參數(shù)都可調(diào)節(jié)起來:
把剩下的layout 和activity貼出來:
activity:
public class LeafLoadingActivity extends Activity implements OnSeekBarChangeListener, OnClickListener { Handler mHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case REFRESH_PROGRESS: if (mProgress < 40) { mProgress += 1; // 隨機(jī)800ms以內(nèi)刷新一次 mHandler.sendEmptyMessageDelayed(REFRESH_PROGRESS, new Random().nextInt(800)); mLeafLoadingView.setProgress(mProgress); } else { mProgress += 1; // 隨機(jī)1200ms以內(nèi)刷新一次 mHandler.sendEmptyMessageDelayed(REFRESH_PROGRESS, new Random().nextInt(1200)); mLeafLoadingView.setProgress(mProgress); } break; default: break; } }; }; private static final int REFRESH_PROGRESS = 0x10; private LeafLoadingView mLeafLoadingView; private SeekBar mAmpireSeekBar; private SeekBar mDistanceSeekBar; private TextView mMplitudeText; private TextView mDisparityText; private View mFanView; private Button mClearButton; private int mProgress = 0; private TextView mProgressText; private View mAddProgress; private SeekBar mFloatTimeSeekBar; private SeekBar mRotateTimeSeekBar; private TextView mFloatTimeText; private TextView mRotateTimeText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.leaf_loading_layout); initViews(); mHandler.sendEmptyMessageDelayed(REFRESH_PROGRESS, 3000); } private void initViews() { mFanView = findViewById(R.id.fan_pic); RotateAnimation rotateAnimation = DXAnimationUtils.initRotateAnimation(false, 1500, true, Animation.INFINITE); mFanView.startAnimation(rotateAnimation); mClearButton = (Button) findViewById(R.id.clear_progress); mClearButton.setOnClickListener(this); mLeafLoadingView = (LeafLoadingView) findViewById(R.id.leaf_loading); mMplitudeText = (TextView) findViewById(R.id.text_ampair); mMplitudeText.setText(getString(R.string.current_mplitude, mLeafLoadingView.getMiddleAmplitude())); mDisparityText = (TextView) findViewById(R.id.text_disparity); mDisparityText.setText(getString(R.string.current_Disparity, mLeafLoadingView.getMplitudeDisparity())); mAmpireSeekBar = (SeekBar) findViewById(R.id.seekBar_ampair); mAmpireSeekBar.setOnSeekBarChangeListener(this); mAmpireSeekBar.setProgress(mLeafLoadingView.getMiddleAmplitude()); mAmpireSeekBar.setMax(50); mDistanceSeekBar = (SeekBar) findViewById(R.id.seekBar_distance); mDistanceSeekBar.setOnSeekBarChangeListener(this); mDistanceSeekBar.setProgress(mLeafLoadingView.getMplitudeDisparity()); mDistanceSeekBar.setMax(20); mAddProgress = findViewById(R.id.add_progress); mAddProgress.setOnClickListener(this); mProgressText = (TextView) findViewById(R.id.text_progress); mFloatTimeText = (TextView) findViewById(R.id.text_float_time); mFloatTimeSeekBar = (SeekBar) findViewById(R.id.seekBar_float_time); mFloatTimeSeekBar.setOnSeekBarChangeListener(this); mFloatTimeSeekBar.setMax(5000); mFloatTimeSeekBar.setProgress((int) mLeafLoadingView.getLeafFloatTime()); mFloatTimeText.setText(getResources().getString(R.string.current_float_time, mLeafLoadingView.getLeafFloatTime())); mRotateTimeText = (TextView) findViewById(R.id.text_rotate_time); mRotateTimeSeekBar = (SeekBar) findViewById(R.id.seekBar_rotate_time); mRotateTimeSeekBar.setOnSeekBarChangeListener(this); mRotateTimeSeekBar.setMax(5000); mRotateTimeSeekBar.setProgress((int) mLeafLoadingView.getLeafRotateTime()); mRotateTimeText.setText(getResources().getString(R.string.current_float_time, mLeafLoadingView.getLeafRotateTime())); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (seekBar == mAmpireSeekBar) { mLeafLoadingView.setMiddleAmplitude(progress); mMplitudeText.setText(getString(R.string.current_mplitude, progress)); } else if (seekBar == mDistanceSeekBar) { mLeafLoadingView.setMplitudeDisparity(progress); mDisparityText.setText(getString(R.string.current_Disparity, progress)); } else if (seekBar == mFloatTimeSeekBar) { mLeafLoadingView.setLeafFloatTime(progress); mFloatTimeText.setText(getResources().getString(R.string.current_float_time, progress)); } else if (seekBar == mRotateTimeSeekBar) { mLeafLoadingView.setLeafRotateTime(progress); mRotateTimeText.setText(getResources().getString(R.string.current_rotate_time, progress)); } } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onClick(View v) { if (v == mClearButton) { mLeafLoadingView.setProgress(0); mHandler.removeCallbacksAndMessages(null); mProgress = 0; } else if (v == mAddProgress) { mProgress++; mLeafLoadingView.setProgress(mProgress); mProgressText.setText(String.valueOf(mProgress)); } } }
layout:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fed255" android:orientation="vertical" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginTop="100dp" android:text="loading ..." android:textColor="#FFA800" android:textSize=" 30dp" /> <RelativeLayout android:id="@+id/leaf_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="50dp" > <com.baidu.batterysaverDemo.ui.LeafLoadingView android:id="@+id/leaf_loading" android:layout_width="302dp" android:layout_height="61dp" android:layout_centerHorizontal="true" /> <ImageView android:id="@+id/fan_pic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="35dp" android:src="@drawable/fengshan" /> </RelativeLayout> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/seek_content_one" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="15dp" > <TextView android:id="@+id/text_ampair" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#ffffa800" android:textSize="15dp" /> <SeekBar android:id="@+id/seekBar_ampair" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="15dp" android:orientation="horizontal" > <TextView android:id="@+id/text_disparity" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#ffffa800" android:textSize="15dp" /> <SeekBar android:id="@+id/seekBar_distance" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="15dp" android:orientation="horizontal" > <TextView android:id="@+id/text_float_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#ffffa800" android:textSize="15dp" /> <SeekBar android:id="@+id/seekBar_float_time" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="15dp" android:orientation="horizontal" > <TextView android:id="@+id/text_rotate_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#ffffa800" android:textSize="15dp" /> <SeekBar android:id="@+id/seekBar_rotate_time" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_weight="1" /> </LinearLayout> <Button android:id="@+id/clear_progress" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:text="去除進(jìn)度條,玩轉(zhuǎn)弧線" android:textSize="18dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="15dp" android:orientation="horizontal" > <Button android:id="@+id/add_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="增加進(jìn)度: " android:textSize="18dp" /> <TextView android:id="@+id/text_progress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textColor="#ffffa800" android:textSize="15dp" /> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout>
最終效果如下,本來錄了20+s,但是PS只能轉(zhuǎn)5s,所以有興趣的大家自己運(yùn)行的玩吧:
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助。
- 三款A(yù)ndroid炫酷Loading動(dòng)畫組件推薦
- Android自定義加載loading view動(dòng)畫組件
- Android項(xiàng)目實(shí)戰(zhàn)手把手教你畫圓形水波紋loadingview
- Android實(shí)現(xiàn)創(chuàng)意LoadingView動(dòng)畫效果
- Android自定義View實(shí)現(xiàn)loading動(dòng)畫加載效果
- Android中Market的Loading效果實(shí)現(xiàn)方法
- Android Studio卡很久(loading)的問題解決辦法
- Android 自定義通用的loadingview實(shí)現(xiàn)代碼
- Android自定義環(huán)形LoadingView效果
- Android實(shí)現(xiàn)一個(gè)帶粘連效果的LoadingBar
相關(guān)文章
Android build.gradle版本名打包配置的方法
這篇文章主要介紹了Android build.gradle版本名打包配置的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2019-02-02Android開場(chǎng)動(dòng)畫類完整實(shí)現(xiàn)代碼
這篇文章主要介紹了Android開場(chǎng)動(dòng)畫類完整實(shí)現(xiàn)代碼,是非常實(shí)用的功能,需要的朋友可以參考下2014-07-07Android中的android:layout_weight使用詳解
layout_weight的作用是設(shè)置子空間在LinearLayout的重要度(控件的大小比重)。layout_weight的值越低,則控件越重要,下面為大家介紹下具體的使用方法2013-06-06Android實(shí)現(xiàn)梯形TextView效果
TextView(文本框),用于顯示文本的一個(gè)控件,Android開發(fā)中經(jīng)常使用,本文講述如何實(shí)現(xiàn)一個(gè)梯形的TextView2021-05-05Android recycleView的應(yīng)用和點(diǎn)擊事件實(shí)例詳解
這篇文章主要介紹了Android recycleView的應(yīng)用和點(diǎn)擊事件實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下2016-12-12Android開發(fā)Jetpack組件ViewModel使用講解
這篇文章主要介紹了Android?Jetpack架構(gòu)組件?ViewModel詳解,ViewModel類讓數(shù)據(jù)可在發(fā)生屏幕旋轉(zhuǎn)等配置更改后繼續(xù)存在,ViewModel類旨在以注重生命周期的方式存儲(chǔ)和管理界面相關(guān)的數(shù)據(jù),感興趣可以來學(xué)習(xí)一下2022-08-08