
当应用程序开发开始时,我会创建一个带有动画的自定义进度对话框.但是在进一步的开发中,我更改了该应用程序中的某些主题.但是此进度条的代码未更改.但是现在该进度对话框没有显示所需的宽度和高度.是主题效果的任何更改(对话框视图的宽度和高度).
MainActivity的主题是-
<style name="Apptheme.NoActionbar"> <item name="windowActionbar">false</item> <item name="windowNoTitle">true</item> </style> 对于AuthActivity和Splash是
<style name="fullScreen" parent="@style/theme.AppCompat.light.NoActionbar"> <item name="androID:windowNoTitle">true</item> <item name="androID:windowActionbar">false</item> <item name="androID:windowFullscreen">true</item> <item name="androID:windowContentOverlay">@null</item> </style>用于进度对话的主题是-
<style name="NewDialog" parent="androID:theme.Black.NoTitlebar.Fullscreen"><item name="androID:windowFrame">@null</item><item name="androID:windowMinWIDthMajor">90%</item><item name="androID:windowMinWIDthMinor">90%</item><item name="androID:windowBackground">@androID:color/transparent</item><item name="androID:windowIsfloating">true</item><item name="androID:windowContentOverlay">@null</item><item name="androID:windowTitleStyle">@null</item><item name="androID:windowAnimationStyle">@androID:style/Animation.Dialog</item><item name="androID:backgroundDimEnabled">true</item><item name="androID:background">@androID:color/transparent</item></style>该全屏主题还提供给mainActivity中的全屏视频对话框.进度对话的代码是-
overrIDe fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (dialog == null) dialog = Dialog(this,R.style.NewDialog) }fun showProgressDialog() { val ANIM_TIME: Long = 3000 dialog!!.setCancelable(false) dialog!!.setContentVIEw(R.layout.progress_dialoge) val img = dialog!!.findVIEwByID<ImageVIEw>(R.ID.iv_image) var i = 0 val r= object:Runnable { overrIDe fun run() { img.setimageResource(mThumbIDs[i]) i++ if(i >= mThumbIDs.size){ i = 0 } img.postDelayed(this,50) } } img.postDelayed(r,50) val anim = CircularRotateAnimation(img,150f) anim.duration = ANIM_TIME anim.repeatCount = 50 img.animation = anim if (dialog!!.isShowing) { dialog!!.dismiss() } dialog!!.show()}他们是否有任何方法可以影响“另一个”对话框的主题或此进度对话框的活动主题?同样,对于所有活动,此进度对话框都将中断.任何人都可以解释在不更改活动主题的情况下固定进度对话框大小的方法.还尝试使用layoutparams给出宽度和高度.
我的清单是-
<manifest xmlns:androID="http://schemas.androID.com/apk/res/androID" package="com.dnbs.consumerapp"> <uses-permission androID:name="androID.permission.CAMERA"/> <other permimssions> <application androID:allowBackup="true" androID:icon="@mipmap/ic_launcher" androID:label="@string/app_name" androID:largeHeap="true"androID:harDWareAccelerated="false" androID:roundIcon="@mipmap/ic_launcher_round" androID:supportsRtl="true" androID:theme="@style/Apptheme"> <activity androID:name=".activitIEs.MainActivity" androID:label="@string/app_name" androID:configChanges="orIEntation|screenSize|screenLayout" androID:theme="@style/Apptheme.NoActionbar"/> <activity androID:name=".activitIEs.SplashActivity" androID:theme="@style/fullScreenDialog"> <intent-filter> <action androID:name="androID.intent.action.MAIN"/> <category androID:name="androID.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity androID:name=".activitIEs.AuthenticationActivity" androID:windowsoftinputMode="adjustPan" androID:configChanges="orIEntation" androID:theme="@style/fullScreenDialog"/> </application> </manifest>最佳答案我找到了解决方案.由于错误,我在应用程序标签内添加了harDWareAccelerated = false.通过更多的研究,我发现它将影响自定义视图.对于高于或等于API级别14的所有设备,默认情况下将启用硬件加速.而且,如果我们使用标准视图和Drawables,则在全局范围内将其打开不会导致任何不利的绘图效果.所以我在清单上做了如下修改:<manifest xmlns:androID="http://schemas.androID.com/apk/res/androID" package="com.dnbs.consumerapp"> <uses-permission androID:name="androID.permission.CAMERA"/> <other permimssions> <application androID:allowBackup="true" androID:icon="@mipmap/ic_launcher" androID:label="@string/app_name" androID:largeHeap="true" androID:roundIcon="@mipmap/ic_launcher_round" androID:supportsRtl="true" androID:theme="@style/Apptheme"> <activity androID:name=".activitIEs.MainActivity" androID:label="@string/app_name" androID:configChanges="orIEntation|screenSize|screenLayout" androID:theme="@style/Apptheme.NoActionbar"/> <activity androID:name=".activitIEs.SplashActivity" androID:theme="@style/fullScreenDialog"> <intent-filter> <action androID:name="androID.intent.action.MAIN"/> <category androID:name="androID.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity androID:name=".activitIEs.AuthenticationActivity" androID:windowsoftinputMode="adjustPan" androID:configChanges="orIEntation" androID:theme="@style/fullScreenDialog"/> </application> </manifest>我从This link得到解决方案 总结
以上是内存溢出为你收集整理的android-具有动画更改的自定义进度对话框的大小 全部内容,希望文章能够帮你解决android-具有动画更改的自定义进度对话框的大小 所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)