当前位置: 代码迷 >> Android >> 为什么我的Android视图元素不旋转
  详细解决方案

为什么我的Android视图元素不旋转

热度:28   发布时间:2023-08-04 11:56:04.0

我在相对布局内的框架布局内有一个图像按钮。 我将以下内容添加到图像按钮android:rotation="-90"但图像按钮似乎没有改变。 查看层次结构 XML格式

<ImageButton
    android:id="@+id/profile_pic_btn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:background="@drawable/round_profile_pic_btn"
    android:contentDescription="profile picture button"
    android:padding="20dp"
    android:rotation="-90"
    android:layout_gravity="center"
    android:src="@drawable/ic_face_black_48dp"/>

<com.github.lzyzsd.circleprogress.DonutProgress
    android:id="@+id/donut_progress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    custom:donut_progress="70"
    custom:donut_text_size="0dp"
    android:layout_alignTop="@+id/profile_pic_btn"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_above="@+id/textView5"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_gravity="center" />

无法提供评论,因为我的代表还没有。 您是否在任何仿真器或实际设备中尝试过? 我复制了您的xml(circleprogress.DonutProgress东西除外),并且它在模拟器和设备中均有效。

但是,该效果在“设计”模式下不可见。

  相关解决方案