Demo:
Devices =>
2.3 And 4.2
1)MainActivity.java:
package com.venky.displaykannadafont;
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
Devices =>
2.3 And 4.2
1)MainActivity.java:
package com.venky.displaykannadafont;
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 tvKannada = (TextView)
findViewById(R.id.tvKannada);
TextView tvEnglish = (TextView)
findViewById(R.id.tvEnglish);
tvEnglish.setText("In
English\n" + "Welcome");
Typeface faceAkshar = Typeface.createFromAsset(getAssets(),
"akshar.ttf");
tvKannada.setTypeface(faceAkshar);
tvKannada.setText("In
Kannada\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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
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/tvKannada"
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>
Download akshar.ttf file and put into asset folder.
To download akshar.ttf file Click Here
4)Download this code Click Here
It is really helpful. Thank you
ReplyDeleteHello! If you’re interested to localize web software, PC software, mobile software or any other type of software, I warmly recommend this online collaborative localization tool: https://poeditor.com/
ReplyDeleteIt's the most effective and neat translation platform I've seen so far!
kannada fonts are in corrupted text plz do help
ReplyDeleteHope everything is fixed now. It won't be a problem anymore.
ReplyDelete