实现事件触发弹出软键盘,类似调用这样的方法可以显示软键盘:letinputMethodControllerinputMethod.getController()inputMethodController.showTextInput()
在app中实现一个Toast组件功能,使用自定义弹窗组件进行二次封装,关键代码如下:structCustomerDialogToast{controller:CustomDialogController;Proptype:string"info"Propinfo:string""build(){Column(){if(this.type"info"){Text(this.info).fontSize(CommonConstants.fontSize).fontColor(CommonConstants.fontColorInfo).maxLines(1)}if(this.type"loading"){}}.width(CommonConstants.toastWidth).borderRadius(CommonCon...
平板设备智能多窗模式下如何获取窗口宽度,如果不能直接拿到窗口宽度,监控最外层容器宽度也可以?
import{GestureControl}from'ohos.gesture';.onGesture((event:GestureEvent){处理滑动手势if(event.typeGestureType.Swipe&&event.directionSwipeDirection.Up){this.currentVideoIndex(this.currentVideoIndex1+this.videoListUrl.length)%this.videoListUrl.length;}elseif(event.typeGestureType.Swipe&&event.directionSwipeDirection.Down){this.currentVideoIndex(this.currentVideoIndex+1)%this.videoListUrl.length;}});这样的引入报错,是这功能取消了嘛,还是什么,我是想做一个视频上下滑动的效果。
interfaceOffsetRemain{offsetRemain:number}EntryComponentstructIndex{Statemessage:string'HelloWorld';privatescrollernewScroller()StateprivaterefreshOffset:number0privaterefreshThreshold:number100当次滑动的总偏移量,需要滑动开始时重置privatescrollOffset:number0.0Stateprivaterefreshing:booleanfalseStateinnerScrollEnabled:booleantrueswiperControllernewSwiperController()build(){Stack(){Scroll(this.s...
操作步骤:ModuleA:Entry({routeName:'a'})ComponentstructAPage{}ModuleB:Entry({routeName:'b'})ComponentstructBPage{}router.pushNamedRoute({name:'b'})模块间依赖只有A依赖了B,B不需要依赖A。A模块a页面B模块b页面,需要从b页面回到a页面且要带参数。官方api没有回退页面:命名路由跳转。importrouterfrom'ohos.router';router.back({url:'a',params:{info:'info'}});如果只用router.back()可以回退但是没法满足需求,携带回退参数。
onPageShow中编写了异步方法获取持久化缓存信息,子组件的aboutToAppear是否在onPageShow异步方法执行完后执行?用户在首页点击区划站点,跳转区划页面,选择区划后,持久化缓存,跳转回首页。因区划可能变化,需要重新加载数据,目前在onPageShow中调用preferences.getPreferences异步获取缓存的区划信息后给ProvideregionCache赋值。子组件aboutToAppear中通过Consume拿到区划值。
如果一个项目页面跳转层级比较多,而整个工程的Router页面栈有最大容量为32个页面的限制。用NavigationNavRouter太多的话会不会使页面容器嵌套太深?有没有好的解决方案?
windowClass.setWindowSystemBarEnable(names)这个方法会导致所有的页面全屏显示,现在只需要某一个页面全屏显示该如何做?
窗口退至任务管理页面,没有失焦windowEvent回调。https:developer.huawei.comconsumercndocharmonyosreferencesV5jsapiswindowV5onwindowevent10
privatecontrollernewCustomDialogController({builder:CustomDialogView({visible:$visible,onCancel:this.onCancel,onConfirm:this.onConfirm,}),alignment:DialogAlignment.Center,autoCancel:false,backgroundColor:'00000000'})原来设置了backgroundColor基本上弹窗颜色就跟遮罩层差不多,后面手机更新后发现,原来的白色背景又出现了
使用MutableStyledStringappend文本然后给指定的startend之间插入特殊customspan报错Error:Inputspantypecheckfailed.122472bfletstyleStringnewMutableStyledString("")styleString.appendStyledString(newStyledString("第一个段落"+"\r\n"))try{styleString.setStyle({styledKey:StyledStringKey.CUSTOMSPAN,styledValue:newQDParagraphSpan(),start:start,length:endstart})}catch(e){readLogError(e)}exportclassQDParagraphSpanextendsCustomSpan{onMeasure(measureInfo:CustomSpanMeasureInfo):CustomSpanMetrics{return{width:0,height:0}}onDraw(context:DrawContext,drawInfo:CustomSpanDrawInfo):void{}}
想做一个组合动画,在平移动画进行到差不多80%的时候再开启渐隐动画,看animateTo这个只有onFinish的回调方法,这种组合动画怎么实现呢?
https:developer.huawei.comconsumercndocharmonyosreferencesV5tsuniversalattributessheettransitionV5sheetoptions半模态bindSheet每次弹出,其内容都会重新绘制,有没有参数设置能让其保持上次关闭前的状态?
在Page页中,通过Provide(“stackManager”)声明了一个StackManager对象(类似这种),并在Page页包含的各个子组件中用Consume接收并使用。然后需要通过CustomDialog显示一个类似Page页的Widget浮窗,也需要有自己的StackManager对象。这时如果通过Provide(“stackManager”)声明,并提供给Widget的子组件使用时,报jscrash:PropertywiththisnameisprovidedbyoneoftheancestorViewsalready.Provideoverridenotallowed崩溃。看...
全栈若城 的精彩回答获得了0 赞同
wx662108d97e2cc 的精彩回答获得了0 赞同
hm673c38c974de6 的精彩回答获得了0 赞同
hm673c38c974de6 的精彩回答获得了0 赞同
hm673c38ebd6bf2 的精彩回答获得了0 赞同