Android - TextView in Hindi




Android में, textview एक यूजर इंटरफ़ेस control है जो हमारी आवश्यकताओं के आधार पर text को सेट और प्रदर्शित करने में हमारी सहायता करता है textview control label की तरह कार्य करता है और यूजर को यह text को संपादित करने की अनुमति नहीं देता है।

Android में, हम एक textview control बना सकते हैं, textview control को हम दो प्रकार से बना सकते है XML लेआउट फ़ाइल में और functional फ़ाइल में programmatic रूप से बना सकते हैं।

TextView एक ऐसा दृश्य है जिसको न केवल अकेले उपयोग में लाया जाता है, बल्की इसको हम अन्य दृश्यों के साथ भी उपयोग में ला सकते है उदाहरण के लिए जब आप कोई फॉर्म बना रहे हैं, जहां पर आपका edittext view, checkbox view आदि, है तब लेबल और अन्य सूचनाओं का उल्लेख करने के लिए, आपको साथ में textview का उपयोग करना होता है।

Creating a TextView

Android application में XML लेआउट फ़ाइल में textview कंट्रोल को परिभाषित करने का sample तरीका है।

Example Code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView
        android:id="@+id/textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="12dp"
        android:text="Welcome to HtmlTpoint"
        android:textColor="#46455a"
        android:textSize="22dp"
        android:textStyle="bold" />
</LinearLayout>

Android TextView Attributes

For Example
Attribute Description
android: id इसका उपयोग control की uniquely पहचान करने के लिए किया जाता है।
android:hint Text empty हो जाने पर यह संकेत text को प्रदर्शित करने के लिए use होता है।
android:textSize इस विशेषता का उपयोग हम text के आकार को control करने के लिए करते हैं।
android:height यह textview को वास्तव में many पिक्सल tall बना देता है।
android:gravity यह view's के x और y अक्ष द्वारा text को कैसे align करना है इसके लिए use होता है