效果展示
<com.yu.verticaltextview.VerticalTextView
android:id="@+id/view_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#80000000"
android:padding="10dp"
app:text="显示的文字(手动换行添加 \n )"
app:textColor="@android:color/white"
app:textSize="20sp"
app:textAlign="left"
app:isRtl="false"
app:rowSpan="10dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
view_vertical.setText(" 使至塞上\n |王维\n\n大漠孤烟直,\n长河落日圆。")
view_vertical.setRowSpan(10)
view_vertical.setTextAlign(VerticalTextView.TextAlignType.center)
view_vertical.setTextColor(Color.WHITE)
view_vertical.setTextSize(20)
Step 1: Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.xunyang-yuhui:VerticalTextView:v1.0.3'
}