TextView

TextView With Kotlin - Kotlin Android Example 
xml


<TextView    android:id="@+id/textview"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:text="TextView Kotlin Android"    />

MainActivity.kt

import android.content.*
import android.graphics.*
import android.os.*
import android.support.v7.app.*
import android.widget.*

class MainActivity : AppCompatActivity() {
    
    lateinit var textview: TextView
   
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        
        textview = findViewById(R.id.textview)
        
        val face = Typeface.createFromAsset(this.assets, "font.otf")
        
        textview.typeface = face
        
    }
}

Comments

Popular posts from this blog