要使得TextView根据左上角选择从上到下排列,可以通过设置旋转角度来实现。

首先,在XML布局文件中,将TextView的宽度和高度设置为wrap_content,并设置其旋转角度为90度,如下所示:

<TextView
    android:id='@+id/textView'
    android:layout_width='wrap_content'
    android:layout_height='wrap_content'
    android:rotation='90'
    android:text='Hello World!' />

然后,在Java代码中,可以使用`setRotation()`方法动态设置旋转角度,如下所示:

TextView textView = findViewById(R.id.textView);
textView.setRotation(90);

这样就可以实现TextView根据左上角选择从上到下排列的效果了。

Android TextView 旋转实现从上到下排列内容

原文地址: https://www.cveoy.top/t/topic/qpLF 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录