xunyang-yuhui / VerticalTextView

一款显示垂直文字的View

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VerticalTextView

一款显示垂直文字的View

效果展示

捕获v2.PNG 捕获v1.PNG

使用方法

xml添加


<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)
  

Dependency

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'
	}

About

一款显示垂直文字的View


Languages

Language:Java 83.7%Language:Kotlin 16.3%