[英]Rotate ImageView without losing Height
您可以按以下方式尝试此库链接
在项目的build.gradle中包括此库依赖项
compile 'rongi.rotate-layout:rotate-layout:3.0.0'
并且出于旋转目的,您需要使用“ RotateLayout”包装视图
<com.github.rongi.rotate_layout.layout.RotateLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:angle="90"> <!-- Specify rotate angle here -->
<YourLayoutHere
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</YourLayoutHere>
</com.github.rongi.rotate_layout.layout.RotateLayout>
如果要以编程方式旋转它,则
int newAngle = rotateLayout.getAngle() + 90;
rotateLayout.setAngle(newAngle);
根据您提供的信息(在这种情况下,您应该提供布局示例),我认为您需要的是在图像视图中更改scaleType
。
有关不同选项的直观指南,请参阅本文: Android ImageView ScaleType:直观指南 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.