android 固定比例图片裁剪插件,如何在Android中裁剪不同比例的图像?
匿名用戶
將ImageView放置在ConstraintLayout中。 這將授予ImageView訪問(wèn)app:Layout_ConstraintDimensionRatiane的權(quán)限,您可以在其中指定所需的比率。
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constrainedHeight="true"
app:layout_constrainedWidth="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="183:124"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
您也可以通過(guò)編程方式實(shí)現(xiàn)此操作:imageView.updateLayoutParams {
dimensionRatio = "183:70"
}
總結(jié)
以上是生活随笔為你收集整理的android 固定比例图片裁剪插件,如何在Android中裁剪不同比例的图像?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: c语言在dos下执行bat文件,应用do
- 下一篇: 股票做t的方法和技巧