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

How to align views at the bottom of the screen in Android?


অ্যান্ড্রয়েডে ভিউগুলো স্ক্রিনের নিচে সারিবদ্ধ করা

এই উদাহরণটি দেখায় কিভাবে RelativeLayout ব্যবহার করে ভিউগুলো স্ক্রিনের নিচে সারিবদ্ধ করতে হয়।

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

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"
    android:orientation="vertical"
    tools:context=".MainActivity">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center"
        android:padding="16dp"
        android:text="Bottom of the screen"
        android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" />
</RelativeLayout>

ধাপ ৩: MainActivity.java-তে কোড যোগ করুন

package app.tutorialspoint.com.sample;

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

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.tutorialspoint.com.sample">
    <uses-permission android:name="android.permission.INTERNET" />
    <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-তে প্রজেক্টের activity ফাইল খুলুন এবং টুলবারের Run আইকনে ক্লিক করুন। আপনার মোবাইল ডিভাইস নির্বাচন করুন এবং ডিভাইসে ডিফল্ট স্ক্রিন দেখুন।

How to align views at the bottom of the screen in Android?

  1. অ্যান্ড্রয়েড 10-এ লুকানো স্ক্রিন রেকর্ডার সক্ষম করার উপায়

  2. অ্যান্ড্রয়েডে Chrome-এর অ্যাড্রেস বার নিচে আনার পদ্ধতি

  3. Mac OS X-এ আপনার অ্যান্ড্রয়েড ডিভাইসের স্ক্রিন রেকর্ড করার পদ্ধতি

  4. উইন্ডোজ টাস্কবারকে স্ক্রিনের নিচে ফেরত আনুন