0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

鴻蒙系統(tǒng)如何設(shè)置自定義下拉刷新控件

OpenHarmony技術(shù)社區(qū) ? 來源: 鴻蒙技術(shù)社區(qū) ? 作者:中軟國際 ? 2021-09-13 09:24 ? 次閱讀

Ohos-MaterialRefreshLayout 是一個自定義 Material 風格下拉刷新控件,支持設(shè)置水波紋效果,支持下拉刷新侵入式和非侵入式,初始化自動刷新及上滑加載更多,支持刷新頭部自定義圖案,上拉加載更多等。

該控件一般配合 ListContainer 使用,因涉及事件分發(fā)操作,本庫中使用了三方控件 NestedListContainer、事件分發(fā)等方便處理事件攔截分發(fā)事件。

自定義控件結(jié)構(gòu)

MaterialRefreshLayout 控件,首先初始化設(shè)置頭部、腳部布局,在手勢下滑時顯示頭部布局,動態(tài)設(shè)置頭部高度,展示下拉刷新效果,在頁面底部向上滑動時顯示腳部布局,展示上拉加載更多效果,松手時圖形即開始旋轉(zhuǎn)動畫。

下拉圓形轉(zhuǎn)動風格 MaterialRefreshLayout:

MaterialRefreshLayout 包含自定義頭部布局 MaterialHeaderView 和腳部布局 MaterialFooterView。

頭部 MaterialHeaderView 包含圓形轉(zhuǎn)動條 CircleProgressBar 和下拉波紋 MaterialWaveView。

腳部布局 MaterialFooterView 同頭部結(jié)構(gòu)一致,包含圓形轉(zhuǎn)動條 CircleProgressBar 和下拉波紋 MaterialWaveView。

CircleProgressBar 包含有自定義圖形的 MaterialProgressDrawable,設(shè)置圓形的轉(zhuǎn)動圖案。

下拉自定義笑臉風格 MaterialRefreshLayout:

MaterialRefreshLayout 包含 SunLayout 頭部布局和腳部布局 MaterialFooterView。

SunLayout 頭部包含滾動短線 SunLineView 和笑臉 SunFaceView。

當有手勢下滑時,自定義短線 SunLineView,開始旋轉(zhuǎn)動畫,監(jiān)聽刷新動作,在 onSizeChanged 中動態(tài)改變圖形大小。

當手勢向下滑動時,自定義笑臉圖形 SunFaceView,監(jiān)聽刷新動作,在 onSizeChanged 中動態(tài)改變圖形大小。

代碼實現(xiàn)解讀

首先在攔截事件中根據(jù)手指的滑動距離,設(shè)置自定義頭部布局 MaterialHeaderView 可見,底部向上滑動時,當滑到頁面底部,設(shè)置腳部布局 MaterialFooterView 可見。

①事件分發(fā) onInterceptTouchEvent 中設(shè)置頭、腳布局可見

在攔截事件 onInterceptTouchEvent 中,手指移動 TouchEvent.POINT_MOVE 時,根據(jù)滑動距離及是否是在頭部的滑動。

設(shè)置頭部自定義 headerview 是否顯示,再根據(jù)向上滑動距離是否小于 0 及是否滑動到底部加載底部 footerview。

代碼如下:

case TouchEvent.POINT_MOVE:

float currentY = ev.getPointerPosition(0).getY();

Float dy= new BigDecimal(currentY).subtract(new BigDecimal(mTouchY)).floatValue();

if (dy 》 0 && !canChildScrollUp()) {

if (mMaterialHeaderView != null) {

mMaterialHeaderView.setVisibility(Component.VISIBLE);

mMaterialHeaderView.onBegin(this);

} else if (mSunLayout != null) {

mSunLayout.setVisibility(Component.VISIBLE);

mSunLayout.onBegin(this);

}

return true;

} else if (dy 《 0 && !canChildScrollDown() && isLoadMore) {

if (mMaterialFooterView != null && !isLoadMoreing) {

soveLoadMoreLogic();

}

return false;

}

break;

上一步完成后,緊接著就是在觸摸事件中動態(tài)設(shè)置頭部布局高度,水波紋高度,滑到最大距離時,設(shè)置為控件本身高度。

②事件觸摸 onTouchEvent 中設(shè)置高度

在觸摸事件 onTouchEvent 中,當手指下滑,onTouchEvent 中設(shè)置頭部自定義 headerview 的高度,隨著下滑距離增加,動態(tài)設(shè)置水波紋高度,當頭部為侵入式時,設(shè)置 component 向下平移。

代碼如下:

case TouchEvent.POINT_MOVE:

mCurrentY = e.getPointerPosition(0).getY();

float dy = new BigDecimal(mCurrentY).subtract(new BigDecimal(mTouchY)).floatValue();

dy = Math.min(mWaveHeight * 2, dy);

dy = Math.max(0, dy);

if (mChildView != null) {

float offsetY = dy / 2;

float fraction = offsetY / mHeadHeight;

if (mMaterialHeaderView != null) {

mMaterialHeaderView.setHeight((int) offsetY);

mMaterialHeaderView.postLayout();

mMaterialHeaderView.onPull(this, fraction);

} else if (mSunLayout != null) {

mSunLayout.setHeight((int) offsetY);

mSunLayout.postLayout();

mSunLayout.startSunLineAnim(this);

mSunLayout.onPull(this, fraction);

}

if (!isOverlay)

mChildView.setTranslationY(offsetY);

}

在松手時,監(jiān)聽抬起事件 TouchEvent.PRIMARY_POINT_UP,當頭部 headerview 高度大于原有高度時,將頭部設(shè)置為刷新中狀態(tài)。

代碼如下:

if (mMaterialHeaderView.getLayoutConfig().height 》 mHeadHeight) {

updateListener();

mMaterialHeaderView.setHeight((int) mHeadHeight);

mMaterialHeaderView.postLayout();

}

再接下來就是完成自定義頭部控件的布局,并在下拉接口方法中設(shè)置下拉時的縮放,透明度等狀態(tài)。

③自定義頭部 MaterialHeaderView

自定義 MaterialHeaderView 由 MaterialWaveView 和 CircleProgressBar 兩個自定義 Component 組合成,實現(xiàn) MaterialHeadListener 接口。

onBegin 方法中設(shè)置 materialWaveView 的起始狀態(tài),circleProgressBar 縮放大小,透明度等。

代碼如下:

@Overridepublic void onBegin(MaterialRefreshLayout materialRefreshLayout) {

if (materialWaveView != null) {

materialWaveView.onBegin(materialRefreshLayout);

}

if (circleProgressBar != null) {

circleProgressBar.setScaleX(0.001f);

circleProgressBar.setScaleY(0.001f);

circleProgressBar.onBegin(materialRefreshLayout);

}

}

onPull 方法中設(shè)置 materialWaveView 的下拉狀態(tài),circleProgressBar 縮放大小,透明度等。

代碼如下:

@Overridepublic void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {

if (materialWaveView != null) {

materialWaveView.onPull(materialRefreshLayout, fraction);

}

if (circleProgressBar != null) {

circleProgressBar.onPull(materialRefreshLayout, fraction);

float a = Util.limitValue(1, fraction);

circleProgressBar.setScaleX(a);

circleProgressBar.setScaleY(a);

circleProgressBar.setAlpha(a);

}

}

設(shè)置刷新中 onRefreshing 狀態(tài)。代碼如下:

@Overridepublic void onRefreshing(MaterialRefreshLayout materialRefreshLayout) {

if (materialWaveView != null) {

materialWaveView.onRefreshing(materialRefreshLayout);

}

if (circleProgressBar != null) {

circleProgressBar.onRefreshing(materialRefreshLayout);

}

}

onComlete 刷新完成后自定義 Component 的狀態(tài)初始化,代碼如下:

@Override

public void onComlete(MaterialRefreshLayout materialRefreshLayout) {

if (materialWaveView != null) {

materialWaveView.onComlete(materialRefreshLayout);

}

if (circleProgressBar != null) {

circleProgressBar.onComlete(materialRefreshLayout);

circleProgressBar.setTranslationY(0);

circleProgressBar.setScaleX(0);

circleProgressBar.setScaleY(0);

}

}

頭部布局完成后,接下來就是實現(xiàn)自定義腳部布局實現(xiàn)。

④自定義腳部 MaterialFooterView

自定義 MaterialFooterView 由 MaterialWaveView 和 CircleProgressBar 兩個自定義 Component 組合成,實現(xiàn) MaterialHeadListener 接口?;就?MaterialHeaderView 一致,接口實現(xiàn)方法設(shè)置內(nèi)容相同。

onBegin 方法中設(shè)置 materialWaveView 的起始狀態(tài),circleProgressBar 縮放 1,透明度等。

代碼如下:

@Overridepublic void onBegin(MaterialRefreshLayout materialRefreshLayout) {

if (materialWaveView != null) {

materialWaveView.onBegin(materialRefreshLayout);

}

if (circleProgressBar != null) {

circleProgressBar.onBegin(materialRefreshLayout);

circleProgressBar.setScaleX(1);

circleProgressBar.setScaleY(1);

}

}

onPull 方法中設(shè)置 materialWaveView 的下拉狀態(tài),circleProgressBar 縮放 1,透明度等。

代碼如下:

@Overridepublic void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {

if (materialWaveView != null) {

materialWaveView.onPull(materialRefreshLayout, fraction);

}

if (circleProgressBar != null) {

circleProgressBar.onPull(materialRefreshLayout, fraction);

float a = Util.limitValue(1, fraction);

circleProgressBar.setScaleX(1);

circleProgressBar.setScaleY(1);

circleProgressBar.setAlpha(a);

}

}

設(shè)置刷新中 onRefreshing 狀態(tài)。代碼如下:

@Overridepublic void onRefreshing(MaterialRefreshLayout materialRefreshLayout) {

if (materialWaveView != null) {

materialWaveView.onRefreshing(materialRefreshLayout);

}

if (circleProgressBar != null) {

circleProgressBar.onRefreshing(materialRefreshLayout);

}

}

onComlete 刷新完成后自定義 Component 的狀態(tài)初始化,代碼如下:

@Overridepublic void onComlete(MaterialRefreshLayout materialRefreshLayout) {

if (materialWaveView != null) {

materialWaveView.onComlete(materialRefreshLayout);

}

if (circleProgressBar != null) {

circleProgressBar.onComlete(materialRefreshLayout);

circleProgressBar.setTranslationY(0);

circleProgressBar.setScaleX(0);

circleProgressBar.setScaleY(0);

}

}

頭部、腳部布局都完成后,就開始要完成頭部和腳部布局里面的自定義組件,首先從頭部布局中的自定義組件開始。

前面講到頭部由圓形轉(zhuǎn)動條 CircleProgressBar 和下拉波紋 MaterialWaveView 組成,先開始繪制波浪紋 MaterialWaveView,實現(xiàn) MaterialHeadListener 接口,接口回調(diào)中設(shè)置組件的狀態(tài)。

⑤自定義 MaterialWaveView

初始化畫筆設(shè)置,添加 addDrawTask 任務(wù),onDraw 方法中繪制下拉區(qū)域圖形,并填充顏色。

代碼如下:

@Overridepublic void onDraw(Component component, Canvas canvas) {

path.reset();

paint.setColor(new Color(color));

path.lineTo(0, headHeight);

path.quadTo(getEstimatedWidth() / (float) 2, headHeight + waveHeight, getEstimatedWidth(), headHeight);

path.lineTo(getEstimatedWidth(), 0);

canvas.drawPath(path, paint);

}

實現(xiàn) MaterialHeadListener 接口,監(jiān)聽各下拉方法的回調(diào),當有下拉的情形時,改變下拉區(qū)域狀態(tài)。下拉時在 onPull 中,設(shè)置下拉區(qū)域 header 高度及 wave 高度。

刷新中 onRefreshing,加載數(shù)值動畫并動態(tài)改變 wave 高度。結(jié)束 onComlete 中,加載數(shù)值動畫動態(tài)改變 head 的高度。代碼如下:

下拉時:

@Overridepublic void onPull(MaterialRefreshLayout br, float fraction) {

setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight) * Util.limitValue(1, fraction)));

setWaveHeight((int) (Util.dip2px(getContext(), DefaulWaveHeight) * Math.max(0, new BigDecimal(fraction).subtract(new BigDecimal(1)).floatValue())));

invalidate();

}

刷新時:

@Override

public void onRefreshing(MaterialRefreshLayout br) {

setHeadHeight((int) (Util.dip2px(getContext(), DefaulHeadHeight)));

int waveHeight = getWaveHeight();

AnimatorValue animator = new AnimatorValue();

animator.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() {

@Override

public void onUpdate(AnimatorValue animatorValue, float value) {

setWaveHeight(getIntValue((1 - (double) value) * waveHeight));

invalidate();

}

});

animator.setCurveType(Animator.CurveType.BOUNCE);

animator.setDuration(200);

animator.start();

}

結(jié)束時:

@Override

public void onComlete(MaterialRefreshLayout br) {

waveHeight = 0;

AnimatorValue animator = new AnimatorValue();

animator.setDuration(200);

animator.setValueUpdateListener(new AnimatorValue.ValueUpdateListener() {

@Override

public void onUpdate(AnimatorValue animatorValue, float value) {

headHeight = getIntValue((1 - (double) value) * headHeight);

invalidate();

}

});

animator.start();

}

上一步完成后接下來開始實現(xiàn)頭部圓形轉(zhuǎn)動的 CircleProgressBar,并設(shè)置圖案的自定義 ShapeElement 圖形,配合手勢操作,下拉時設(shè)置圖形動態(tài)大小,松手時旋轉(zhuǎn)刷新。

⑥自定義 CircleProgressBar

自定義圓形轉(zhuǎn)動 CircleProgressBar,設(shè)置自定義背景 MaterialProgressDrawable,實現(xiàn) MaterialHeadListener 接口。

根據(jù)下拉狀態(tài)設(shè)置圓形 MaterialProgressDrawable 旋轉(zhuǎn)角度,釋放手勢時開始動畫,結(jié)束后停止旋轉(zhuǎn)并初始化狀態(tài)等。

代碼如下:

@Overridepublic void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {

if (mProgressDrawable != null)

mProgressDrawable.setProgressRotation(fraction);

invalidate();

}

@OverridePublic void onRefreshing(MaterialRefreshLayout materialRefreshLayout) {

if (mProgressDrawable != null) {

mProgressDrawable.onStart();

}

}

@Overridepublic void onComlete(MaterialRefreshLayout materialRefreshLayout) {

if (mProgressDrawable != null) {

mProgressDrawable.onStop();

}

setVisibility(Component.INVISIBLE);

}

自定義 MaterialProgressDrawable 設(shè)置 CircleProgressBar 的背景,首先構(gòu)造方法中初始化圓形 Ring 和旋轉(zhuǎn)動畫,設(shè)置畫筆顏色,寬度,大小,在 drawToCanvas 中繪制圓形 Ring。

當有手勢操作時調(diào)用 onStart 方法中的旋轉(zhuǎn)動畫,開始旋轉(zhuǎn)。在 Ring 類 draw 方法中,根據(jù)起始旋轉(zhuǎn)角度繪制圓形圈圈及三角箭頭。

代碼如下:

public void draw(Canvas c, Rect bounds) {

final RectFloat arcBounds = mTempBounds;

arcBounds.modify(bounds);

arcBounds.left = new BigDecimal(arcBounds.left).add(new BigDecimal(mStrokeInset)).floatValue();

arcBounds.top = new BigDecimal(arcBounds.top).add(new BigDecimal(mStrokeInset)).floatValue();

arcBounds.right = new BigDecimal(arcBounds.right).subtract(new BigDecimal(mStrokeInset)).floatValue();

arcBounds.bottom = new BigDecimal(arcBounds.bottom).subtract(new BigDecimal(mStrokeInset)).floatValue();

final float startAngle = new BigDecimal(mStartTrim).add(new BigDecimal(mRotation)).floatValue() * 360;

final float endAngle = new BigDecimal(mEndTrim).add(new BigDecimal(mRotation)).floatValue() * 360;

float sweepAngle = new BigDecimal(endAngle).subtract(new BigDecimal(startAngle)).floatValue();

mPaint.setColor(Color.RED);

c.drawArc(arcBounds, new Arc(startAngle, sweepAngle, false), mPaint);

drawTriangle(c, startAngle, sweepAngle, bounds);

if (mAlpha 《 255) {

mCirclePaint.setColor(new Color(mBackgroundColor));

mCirclePaint.setAlpha(255 - mAlpha);

c.drawCircle(bounds.getCenterX(), bounds.getCenterY(), bounds.getWidth() / (float) 2,

mCirclePaint);

}

}

上述基本上就完成了 Material 風格下拉刷新帶水波紋,帶轉(zhuǎn)動 progressbar 的實現(xiàn)步驟,緊接著講一講下拉自定義笑臉的另外一種刷新風格,實際上就是重新定義了刷新頭部的圖形,在這里也可以自己嘗試替換成其它不同的圖形。

⑦自定義頭部 SunLayout 布局

自定義頭部 SunLayout 由 SunFaceView 和 SunLineView 組成,SunFaceView 為自定義笑臉,SunLineView 為自定義笑臉周圍短線。

SunLayout 實現(xiàn)了 MaterialHeadListener 接口,開始狀態(tài) onBegin 時縮放從零到有,下拉 onPull 時,設(shè)置 SunView 和 LineView 的大小,縮放等。代碼如下:

開始時:

@Override

public void onBegin(MaterialRefreshLayout materialRefreshLayout) {

setScaleX(0.001f);

setScaleY(0.001f);

}

下拉時:

@Overridepublic void onPull(MaterialRefreshLayout materialRefreshLayout, float fraction) {

float a = Util.limitValue(1, fraction);

if (a 》= 0.7) {

mLineView.setVisibility(VISIBLE);

} else {

mLineView.setVisibility(HIDE);

}

mSunView.setPerView(mSunRadius, a);

mLineView.setLineWidth(mLineWidth);

setScaleX(a);

setScaleY(a);

setAlpha(a);

}

自定義笑臉 SunFaceView,自定義短線 SunLineView。

SunLineView 繼承 Component 實現(xiàn) Component.DrawTask, Component.EstimateSizeListener 接口,構(gòu)造方法中初始化 Paint,onEstimateSize 中測量寬高,onDraw 中繪制線條。代碼如下:

測量時:

@Overridepublic boolean onEstimateSize(int widthMeasureSpec, int heightMeasureSpec) {

HiLog.info(Contants.LABEL, “onMeasure”);

int widthMode = EstimateSpec.getMode(widthMeasureSpec);

int widthSize = EstimateSpec.getSize(widthMeasureSpec);

int heightMode = EstimateSpec.getMode(heightMeasureSpec);

int heightSize = EstimateSpec.getSize(heightMeasureSpec);

int width;

int height;

if (widthMode == EstimateSpec.PRECISE) {

width = widthSize;

} else {

width = (mSunRadius + mFixLineHeight + mLineHeight) * 2 + getPaddingRight() + getPaddingLeft();

}

if (heightMode == EstimateSpec.PRECISE) {

height = heightSize;

} else {

height = (mSunRadius + mFixLineHeight + mLineHeight) * 2 + getPaddingTop() + getPaddingBottom();

}

setEstimatedSize(width, height);

mWidth = width;

mHeight = height;

return false;

}

畫線條:

private void drawLines(Canvas canvas) {

for (int i = 0; i 《= 360; i++) {

if (i % mLineLevel == 0) {

mLineLeft = mWidth / 2 - mLineWidth / 2;

mLineTop = mHeight / 2 - mSunRadius - mFixLineHeight;

mLineBottom = mLineTop + mLineHeight;

}

canvas.save();

canvas.rotate(i, mWidth / (float) 2, mHeight / (float) 2);

canvas.drawLine(mLineLeft, mLineTop, mLineLeft, mLineBottom, mLinePaint);

canvas.restore();

}

}

代碼參考:

https://gitee.com/chinasoft5_ohos/Ohos-MaterialRefreshLayout

作者:盧經(jīng)緯

責任編輯:haq

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學習之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • 操作系統(tǒng)
    +關(guān)注

    關(guān)注

    37

    文章

    6942

    瀏覽量

    124175
  • 中軟國際
    +關(guān)注

    關(guān)注

    0

    文章

    563

    瀏覽量

    7336
  • 鴻蒙系統(tǒng)
    +關(guān)注

    關(guān)注

    183

    文章

    2638

    瀏覽量

    67069
  • HarmonyOS
    +關(guān)注

    關(guān)注

    79

    文章

    1987

    瀏覽量

    31113

原文標題:鴻蒙下拉刷新組件,這個最好用!

文章出處:【微信號:gh_834c4b3d87fe,微信公眾號:OpenHarmony技術(shù)社區(qū)】歡迎添加關(guān)注!文章轉(zhuǎn)載請注明出處。

收藏 人收藏

    評論

    相關(guān)推薦

    如何添加自定義單板

    在開發(fā)過程中,用戶有時需要創(chuàng)建自定義板配置。本節(jié)將通過一個實例講解用戶如何創(chuàng)建屬于自己的machine,下面以g2l-test.conf為例進行說明。
    的頭像 發(fā)表于 03-12 14:43 ?192次閱讀

    如何快速創(chuàng)建用戶自定義Board和App工程

    概述自HPM_SDKv1.7.0發(fā)布開始,在HPM_ENV中新增了user_template文件夾,以方便用戶快速創(chuàng)建自定義的Board和App工程。user_template是用戶模板工程,用戶
    的頭像 發(fā)表于 02-08 13:38 ?161次閱讀
    如何快速創(chuàng)建用戶<b class='flag-5'>自定義</b>Board和App工程

    Altium Designer 15.0自定義元件設(shè)計

    電子發(fā)燒友網(wǎng)站提供《Altium Designer 15.0自定義元件設(shè)計.pdf》資料免費下載
    發(fā)表于 01-21 15:04 ?0次下載
    Altium Designer 15.0<b class='flag-5'>自定義</b>元件設(shè)計

    think-cell:自定義think-cell(四)

    C.5 設(shè)置默認議程幻燈片布局 think-cell 議程可以在演示文稿中使用特定的自定義布局來定義議程、位置和議程幻燈片上的其他形狀,例如標題或圖片。通過將此自定義布局添加到模板,您
    的頭像 發(fā)表于 01-13 10:37 ?194次閱讀
    think-cell:<b class='flag-5'>自定義</b>think-cell(四)

    think-cell;自定義think-cell(一)

    本章介紹如何自定義 think-cell,即如何更改默認顏色和其他默認屬性;這是通過 think-cell 的樣式文件完成的,這些文件將在前四個部分中進行討論。 第五部分 C.5 設(shè)置默認議程幻燈片
    的頭像 發(fā)表于 01-08 11:31 ?312次閱讀
    think-cell;<b class='flag-5'>自定義</b>think-cell(一)

    創(chuàng)建自定義的基于閃存的引導加載程序(BSL)

    電子發(fā)燒友網(wǎng)站提供《創(chuàng)建自定義的基于閃存的引導加載程序(BSL).pdf》資料免費下載
    發(fā)表于 09-19 10:50 ?0次下載
    創(chuàng)建<b class='flag-5'>自定義</b>的基于閃存的引導加載程序(BSL)

    如何自定義內(nèi)存控制器的設(shè)置

    策略都有其特定的使用場景和優(yōu)缺點。以下是一些步驟和建議,用于自定義內(nèi)存控制器的設(shè)置: 1. 選擇合適的內(nèi)存分配策略 heap_1 :最簡單的內(nèi)存分配策略,但分配的內(nèi)存不允許釋放。適用于那些一旦分配就長期使用的場景。 heap_2 :支持動態(tài)內(nèi)存的申請和釋放,但不支持內(nèi)存碎
    的頭像 發(fā)表于 09-02 14:28 ?660次閱讀

    【AWTK使用經(jīng)驗】如何自定義combo_box下拉框樣式

    需要在ZTP800示教器實現(xiàn)一個用于日期選擇的下拉框,并且還要求對下拉框做一些美化,此時就需要用戶自定義下拉框樣式。下面將結(jié)合該需求介紹兩種修改combo_box
    的頭像 發(fā)表于 05-23 08:25 ?586次閱讀
    【AWTK使用經(jīng)驗】如何<b class='flag-5'>自定義</b>combo_box<b class='flag-5'>下拉</b>框樣式

    HarmonyOS開發(fā)案例:【 自定義彈窗】

    基于ArkTS的聲明式開發(fā)范式實現(xiàn)了三種不同的彈窗,第一種直接使用公共組件,后兩種使用CustomDialogController實現(xiàn)自定義彈窗
    的頭像 發(fā)表于 05-16 18:18 ?1579次閱讀
    HarmonyOS開發(fā)案例:【 <b class='flag-5'>自定義</b>彈窗】

    TSMaster 自定義 LIN 調(diào)度表編程指導

    LIN(LocalInterconnectNetwork)協(xié)議調(diào)度表是用于LIN總線通信中的消息調(diào)度的一種機制,我們收到越來越多來自不同用戶希望能夠通過接口實現(xiàn)自定義LIN調(diào)度表的需求。所以在
    的頭像 發(fā)表于 05-11 08:21 ?835次閱讀
    TSMaster <b class='flag-5'>自定義</b> LIN 調(diào)度表編程指導

    HarmonyOS實戰(zhàn)開發(fā)-深度探索與打造個性化自定義組件

    今天分享一下 什么是自定義組件?及其自定義組件的實戰(zhàn)。 做過前端或者android開發(fā)的都知道自定義組件,鴻蒙中顯示在界面上的UI都稱為組件,小打一個按鈕,再到一個列表。
    發(fā)表于 05-08 16:30

    HarmonyOS開發(fā)案例:【自定義下拉刷新動畫】

    主要介紹組件動畫animation屬性設(shè)置。當組件的某些通用屬性變化時,可以通過屬性動畫實現(xiàn)漸變效果,提升用戶體驗。
    的頭像 發(fā)表于 04-29 16:06 ?1108次閱讀
    HarmonyOS開發(fā)案例:【<b class='flag-5'>自定義</b><b class='flag-5'>下拉</b><b class='flag-5'>刷新</b>動畫】

    LabVIEW里Ring自定義控件,其常量無法保持同步修改,如何解決

    。 自定義控件已經(jīng)使用了“嚴格自定義控件”這一設(shè)置。 Ring控件雖然已經(jīng)綁定
    發(fā)表于 04-24 11:20

    HarmonyOS開發(fā)實例:【自定義Emitter】

    使用[Emitter]實現(xiàn)事件的訂閱和發(fā)布,使用[自定義彈窗]設(shè)置廣告信息。
    的頭像 發(fā)表于 04-14 11:37 ?1129次閱讀
    HarmonyOS開發(fā)實例:【<b class='flag-5'>自定義</b>Emitter】

    鴻蒙ArkUI實例:【自定義組件】

    組件是 OpenHarmony 頁面最小顯示單元,一個頁面可由多個組件組合而成,也可只由一個組件組合而成,這些組件可以是ArkUI開發(fā)框架自帶系統(tǒng)組件,比如?`Text`?、?`Button`?等,也可以是自定義組件,本節(jié)筆者簡單介紹一下
    的頭像 發(fā)表于 04-08 10:17 ?774次閱讀