gpt4 book ai didi

android - 如何制作垂直的TextView

转载 作者:搜寻专家 更新时间:2023-11-01 09:47:37 26 4
gpt4 key购买 nike

我正在 Android 中制作一个应用程序,目前我正在尝试制作一个垂直的 TextView。我希望它看起来像这样。

enter image description here

有谁知道如何实现这个,或者至少有一个现有的库可以用来实现这个效果。

谢谢

最佳答案

If you want vertical Text View like this then you need to pass \n to Text View text property.

引用这个。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">


<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#000"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="5dp"
android:text="A\nB\nC\nD\n"
android:textColor="#FFF"
android:textSize="18dp" />

</RelativeLayout>

关于android - 如何制作垂直的TextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37230167/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com