android自定义对话框大小,android-具有动画更改的自定义进度对话框的大小

当应用程序开发开始时,我会创建一个带有动画的自定义进度对话框.但是在进一步的开发中,我更改了该应用程序中的某些主题.但是此进度条的代码未更改.但是现在该进度对话框没有显示所需的宽度和高度.是主题效果的任何更改(对话框视图的宽度和高度).

MainActivity的主题是-

false

true

对于AuthActivity和Splash是

true

false

true

@null

用于进度对话的主题是-

@null

90%

90%

@android:color/transparent

true

@null

@null

@android:style/Animation.Dialog

true

@android:color/transparent

该全屏主题还提供给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(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给出宽度和高度.

我的清单是-

package="com.dnbs.consumerapp">

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">

android:name=".activities.MainActivity"

android:label="@string/app_name"

android:configChanges="orientation|screenSize|screenLayout"

android:theme="@style/AppTheme.NoActionBar"/>

android:theme="@style/fullScreenDialog">

android:windowSoftInputMode="adjustPan"

android:configChanges="orientation"

android:theme="@style/fullScreenDialog"/>

解决方法:

我找到了解决方案.由于错误,我在应用程序标签内添加了hardwareAccelerated = false.通过更多的研究,我发现它将影响自定义视图.对于高于或等于API级别14的所有设备,默认情况下将启用硬件加速.而且,如果我们使用标准视图和Drawables,则在全局范围内将其打开不会导致任何不利的绘图效果.所以我在清单上做了如下修改:

package="com.dnbs.consumerapp">

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">

android:name=".activities.MainActivity"

android:label="@string/app_name"

android:configChanges="orientation|screenSize|screenLayout"

android:theme="@style/AppTheme.NoActionBar"/>

android:theme="@style/fullScreenDialog">

android:windowSoftInputMode="adjustPan"

android:configChanges="orientation"

android:theme="@style/fullScreenDialog"/>

标签:android-layout,kotlin,themes,progress-bar,android

来源: https://codeday.me/bug/20191210/2105171.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值