This project is a demonstration of how to implement and manage multiple Fragments in an Android application. It showcases the use of FrameLayout
containers to display two fragments side by side, making it ideal for learning about modular UI design in Android development.
The application displays two fragments:
- First Fragment: Displays the user's full name (
AMARJEET KUMAR
) - Second Fragment: Displays the user's roll number (
21BCS10768
)
Each fragment has a distinct background color and is aligned horizontally for clarity and separation of information.
- Fragment creation and management
- Modular UI design using
FrameLayout
- Responsive layout structure
- Clean separation of responsibilities across XML and Java classes
Amarjeet Kumar
UID: 21BCS10768
Department of Computer Science & Engineering
Chandigarh University
Portfolio: https://amarjeetkr.vercel.app/
LinkTree: https://linktr.ee/AmarjeetKumarJyotish
GitHub: https://github.com/AmarjeetJyotis
LinkedIn: https://www.linkedin.com/in/amarjeet-jyotish/
GeeksforGeeks: https://www.geeksforgeeks.org/user/amarjeetjyotish/
LeetCode: https://leetcode.com/u/AmarjeetJyotish/
app/
├── java/
│ └── com.example.fragmentexample/
│ ├── MainActivity.java
│ ├── Fragment1.java
│ └── Fragment2.java
├── res/
│ ├── layout/
│ │ ├── activity_main.xml
│ │ ├── fragment1.xml
│ │ ├── fragment2.xml
│ │ ├── fragment_fragment1.xml
│ │ └── fragment_fragment2.xml
│ └── values/
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
🚀 Getting Started
Prerequisites
Android Studio (recommended: latest stable version)
Android SDK (minimum API level 21)
Emulator or physical Android device for testing
Setup Instructions
Clone the repository or download the project ZIP.
Open the project in Android Studio.
Sync Gradle and let dependencies resolve.
Click Run to deploy the app on an emulator or connected device.
🖼️ Screenshots
1st Fragment 2nd Fragment
AMARJEET KUMAR 21BCS10768
The two fragments are displayed side-by-side with centered text views.
📜 License
This project is developed for academic and demonstration purposes. Feel free to fork or reuse with appropriate attribution.
yaml
Copy
Edit
---
Let me know if you'd like to include:
- A badge for build status, Android API level, or license
- Screenshots/images embedded directly from your GitHub repository
- Contribution guidelines or issue templates
I can also generate a downloadable `.md` file if needed.