Android Splash Screen Example
android splash screen প্রিয় বন্ধুগণ কিভাবে অ্যান্ড্রয়েড স্টুডিও দিয়ে স্প্ল্যাশ স্ক্রিন তৈরি করতে হয়। অর্থাৎ অ্যান্ড্রয়েড অ্যাপ ওপেন হওয়ার সময় লোগো টেক্সট অথবা প্রগ্রেস বার 5 সেকেন্ড দেখায় এন্ড অটোমেটিক ক্লোজ হয়ে হোমপেইজে যায় এটা কিভাবে প্রোগ্রামিং করা হয় android-studio দিয়ে।
Android Splash Screen Example
কয়েকটা স্টেপ এর মাধ্যমে প্রোগ্রামগুলো করা হয় দয়া করে নিচের স্টেপগুলো ফলো করুন এবং অ্যান্ড্রয়েড স্টুডিওতে নতুন হলে ইউটিউব থেকে আমাদের কমপ্লিট ভিডিও কোর্স ফ্রিতে দেখুন।
Step 1 :Creating Project
Step 2: Put any image in drawable folder with name “logo”
Step 3 : Creating Splash_Screen layout file
Step 4: Create Splash_Screen
Step 5 : Creating Layout
Step 6 : Creating HomeActivity
Step 7 : Changing AndroidManifest.xml
Step 7 : Running the app
\app\src\main\res\layout\Splash_Screen.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_gravity="center" android:gravity="center" android:layout_height="match_parent" tools:context=".Splash_Screen"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="180dp" android:layout_margin="20dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:layout_marginBottom="20dp" tools:srcCompat="@drawable/logo" /> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:layout_marginStart="20dp" android:layout_marginTop="20dp" android:layout_marginEnd="20dp" android:layout_marginBottom="20dp" android:text="@string/app_name" android:textSize="20dp" /> <ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /> </LinearLayout> </RelativeLayout>
\app\src\main\java\com\nnb24\Example\Splash_Screen.java
import android.content.Intent; import android.os.Bundle; import android.os.Handler; public class Splash_Screen extends AppCompatActivity { Handler handler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash_screen); handler=new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Intent intent=new Intent(Splash_Screen.this,HomeActivity.class); startActivity(intent); finish(); } },3000); } }
\app\src\main\res\drawable\logo.png
অ্যান্ড্রয়েড স্টুডিও তে লোগোটি কপি-পেষ্ট করুন। কিভাবে লোগো তৈরি করতে হয় আপনি যদি একদম নতুন হয়ে থাকেন লোগো তৈরী করতে না পারেন তাহলে আমাদের এই পোস্টটি দেখতে পারেন।
\app\src\main\AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <application android:allowBackup="true" android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="@xml/backup_rules" android:icon="@drawable/logo" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.NNB24" tools:targetApi="31"> <activity android:name=".Splash_Screen" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
splash screen in android studio source code
android-studio সাহায্যে স্প্ল্যাশ স্ক্রিন তৈরি করতে পারেন, যদি তৈরি করতেন না জানেন তাহলে আমরা নিচে সোর্সকোড দিয়ে দিলাম যেগুলো ডাউনলোড করে অ্যান্ড্রয়েড স্টুডিওতে ইনপুট করতে পারেন।