Demo:
1)MainActivity.java:
package com.venky.displaytamilfont;
2)activity_main.xml:
3)TTF File:
Download akshar.ttf file and put into asset folder.
To Download akshar.ttf file Click Here
4)Download this code Click Here
1)MainActivity.java:
package com.venky.displaytamilfont;
import
android.app.Activity;
import
android.graphics.Typeface;
import
android.os.Bundle;
import
android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tvTamil = (TextView)
findViewById(R.id.tvTamil);
TextView tvEnglish = (TextView)
findViewById(R.id.tvEnglish);
tvEnglish.setText("In
English\n" + "Welcome");
Typeface faceAkshar = Typeface.createFromAsset(getAssets(),
"akshar.ttf");
tvTamil.setTypeface(faceAkshar);
tvTamil.setText("In
Tamil\n" + "நல்வரவு");
}
}
2)activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#5F04B4"
tools:context=".MainActivity"
>
<TextView
android:id="@+id/tvEnglish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="51dp"
android:text="text1"
android:textColor="#ffffff"
android:textSize="20dp"
/>
<TextView
android:id="@+id/tvTamil"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/tvEnglish"
android:layout_below="@+id/tvEnglish"
android:layout_marginTop="66dp"
android:text="text2"
android:textColor="#ffffff"
android:textSize="20dp"
android:textStyle="bold"
/>
</RelativeLayout>
3)TTF File:
Download akshar.ttf file and put into asset folder.
To Download akshar.ttf file Click Here
4)Download this code Click Here
No comments:
Post a Comment