Menu

Related Topics

HTML CSS JavaScript PHP Node.js React.js C C++ Go Rust Swift Python Java Excel MS Word PowerPoint
Search

Android UI Components in Hindi

Android में UI (User Interface) Components का उपयोग Screen पर Elements (जैसे Button, TextView, ImageView, EditText आदि) को दिखाने और User Interaction को Handle करने के लिए किया जाता है।

1. TextView (text दिखाने के लिए)

Example (TextView in XML)

<TextView
    android:id="@+id/textView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Hello, Android!"
    android:textSize="20sp"
    android:textColor="#000000" />

Example (Java Code में Text Set करना)

TextView textView = findViewById(R.id.textView);
textView.setText("Welcome to Android!");

2. Button (buttom पर click करने के लिए)

Button Android का एक सबसे Common UI Component है, जिसका उपयोग User से Interaction के लिए किया जाता है। जब User किसी Button को Tap या Click करता है, तो एक Action Trigger होता है, जैसे:

Android में Button को XML (UI Design) और Java/Kotlin (Event Handling) में Define किया जाता है।

Example (Button in XML)

<Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Click Me" />

Example (Java Code में Button का Event Handle करना)

Button button = findViewById(R.id.button);
button.setOnClickListener(v -> {
    Toast.makeText(MainActivity.this, "Button Clicked!", Toast.LENGTH_SHORT).show();
});

3. EditText (User से Text Input लेने के लिए)

Example (EditText in XML)

<EditText
    android:id="@+id/editText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Enter your name" />

Example (Java Code में Text को Read करना)

EditText editText = findViewById(R.id.editText);
String userInput = editText.getText().toString();
Toast.makeText(MainActivity.this, "You entered: " + userInput, Toast.LENGTH_SHORT).show();

4. RadioButton (Multiple Options में से एक चुनने के लिए)

Example (RadioButton in XML)

<RadioGroup
    android:id="@+id/radioGroup"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <adioButton
        android:id="@+id/radioMale"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Male" />

    <RadioButton
        android:id="@+id/radioFemale"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Female" />
</RadioGroup>

Example (Java Code में Selection को Read करना)

RadioGroup radioGroup = findViewById(R.id.radioGroup);
int selectedId = radioGroup.getCheckedRadioButtonId();
RadioButton selectedRadioButton = findViewById(selectedId);
Toast.makeText(MainActivity.this, "Selected: " + selectedRadioButton.getText(), Toast.LENGTH_SHORT).show();
5. CheckBox (Multiple Options Select करने के लिए)

Example (CheckBox in XML)

<CheckBox
    android:id="@+id/checkBox"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Accept Terms & Conditions" />

Example (Java Code में CheckBox को Handle करना)

CheckBox checkBox = findViewById(R.id.checkBox);
if (checkBox.isChecked()) {
    Toast.makeText(MainActivity.this, "Checkbox is Checked!", Toast.LENGTH_SHORT).show();
}
6. ImageView (Images को Show करने के लिए)

ImageView का उपयोग Screen पर Images Show करने के लिए किया जाता है।

Example (ImageView in XML)

<ImageView
    android:id="@+id/imageView"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:src="@drawable/sample_image" />

Example (Java Code में Image Change करना)

ImageView imageView = findViewById(R.id.imageView);
imageView.setImageResource(R.drawable.new_image);
7. ProgressBar (Loading Show करने के लिए)

ProgressBar का उपयोग तब किया जाता है जब कोई Task (जैसे File Downloading, Data Loading) चल रहा हो।

दो प्रकार के ProgressBar होते हैं:

Example (ProgressBar in XML)

<ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:visibility="gone" />

Example (Java Code में ProgressBar Show/Hide करना)

ProgressBar progressBar = findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE);  // Show ProgressBar
progressBar.setVisibility(View.GONE);     // Hide ProgressBar


Page Views
0
Visit ID
Not tracked yet
Visit Time
-
Time on Page
0 seconds

Request


Leave a Comment


INITIALIZING...


INITIALIZING...


Quizzes in Hindi

GK Online Quiz in Hindi 10 pages
HTML Online Quiz in Hindi 10 pages
CSS Online Quiz in Hindi 10 pages
JavaScript Online Quiz in Hindi 10 pages
CCC Online Quiz in Hindi 10 pages
History Online Quiz in Hindi 10 pages



Comments Total: 0 comments

📰 Latest Articles

Total: 0 Articles

Featured Products

0 Products 0 Loaded 0 Remaining

All Products Loaded!

You've reached the end of our collection.

Contact Us Form