কম্পিউটার টিউটোরিয়াল

এন্ড্রয়েডে TextView-এর ফন্ট আকার পরিবর্তন করার পদ্ধতি

এন্ড্রয়েডে TextView-এর ফন্ট আকার পরিবর্তন করার ধাপাবলী

এই উদাহরণটি দেখায় কীভাবে XML লেআউটে TextView-এর ফন্ট আকার (textSize) এবং ফন্ট পরিবার (fontFamily) সেট করা যায়। এখানে তিনটি ভিন্ন আকারের টেক্সট ভিউ ব্যবহার করা হয়েছে।

ধাপ ১: নতুন প্রজেক্ট তৈরি করুন

Android Studio-তে File → New Project এ যান এবং প্রয়োজনীয় বিবরণ পূরণ করে একটি নতুন প্রজেক্ট তৈরি করুন।

ধাপ ২: লেআউট ফাইল সংশোধন করুন (res/layout/activity_main.xml)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="https://schemas.android.com/apk/res/android"
    xmlns:tools="https://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="আমি বিশাল"
        android:fontFamily="sans-serif-smallcaps"
        android:layout_centerInParent="true"
        android:textSize="64sp" />
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/textView1"
        android:layout_marginBottom="10dp"
        android:text="আমি ছোট"
        android:layout_centerInParent="true"
        android:fontFamily="serif-monospace"
        android:textSize="36sp" />
    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/textView2"
        android:layout_marginBottom="10dp"
        android:text="আমি ছোটো"
        android:layout_centerInParent="true"
        android:fontFamily="serif-monospace"
        android:textSize="24sp" />
</RelativeLayout>

ধাপ ৩: মূল এক্টিভিটি (src/MainActivity.java)

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

ধাপ ৪: ম্যানিফেস্ট ফাইল (AndroidManifest.xml)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="https://schemas.android.com/apk/res/android" package="app.com.sample">
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

অ্যাপ্লিকেশন চালান

আপনার আসল এন্ড্রয়েড ডিভাইস কম্পিউটারের সাথে সংযুক্ত আছে অনুমান করি। Android Studio-তে আপনার প্রজেক্টের এক্টিভিটি ফাইল খুলুন এবং টুলবারের Run আইকনে ক্লিক করুন। আপনার মোবাইল ডিভাইস নির্বাচন করুন এবং আপনার ডিভাইসে ডিফল্ট স্ক্রিন দেখুন।

  1. এক্সেসে ফন্ট ফেস, আকার এবং রং পরিবর্তন করার পদ্ধতি

  2. Matplotlib-এ সায়েন্টিফিক নোটেশনের ফন্ট সাইজ কীভাবে পরিবর্তন করবেন?

  3. গুগল ক্রোমে ওয়েবসাইটের ফন্ট সাইজ পরিবর্তন করার পদ্ধতি

  4. Windows 10-এ টেক্সট সাইজ সমন্বয় করুন: সহজ ধাপে ধাপে গাইড