我想在一个对话框4DP圆角图像。
但当我给4dp(改变为像素),imgae是这样做的。
底角是背景绘制。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners
android:bottomRightRadius="4dp" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners
android:bottomLeftRadius="4dp" />
</shape>
我试过这个代码。请帮帮我😢😢
private fun initView() {
val dm = ctx.resources.displayMetrics
val width = dm.widthPixels - 60
val radius = dpToPx(4).toFloat()
window?.run {
setLayout(width, ViewGroup.LayoutParams.WRAP_CONTENT)
setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
}
Glide.with(ctx)
.load(quizNoticeImage)
.transform(GranularRoundedCorners(radius, radius, 0f, 0f))
.listener(object : RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
noShowAgain()
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?,
isFirstResource: Boolean
): Boolean {
vBarHorizontal.visible()
vBarVertical.visible()
tvNoShowAgain.visible()
tvClose.visible()
return false
}
})
.into(ivQuiz)
ivQuiz.setOnClickListener(this)
tvNoShowAgain.setOnClickListener(this)
tvClose.setOnClickListener(this)
}
我试过滑动覆盖,可变形的图像等.但我不能使这个.第一个图像是12dp(改变为像素)
1条答案
按热度按时间lmyy7pcs1#
您应该尝试像这样定义alertDialog:
和这样的风格: