Android Application Development Cookbook: 93 Recipes for Building Winning Apps



Download 32,34 Mb.
Pdf ko'rish
bet47/56
Sana26.02.2022
Hajmi32,34 Mb.
#470540
1   ...   43   44   45   46   47   48   49   50   ...   56
Bog'liq
Android Application Development Cookbook

reCiPe 2.3 
using rADio buttons
Android Versions
Level 1 and above
permissions
None
source code to download from Wrox.com
RadioButtons.zip
Radio buttons enable users to select one item from a list of available options. This recipe shows how 
to use radio buttons in your Android application.
solution
Assume you have the following code snippet in your 
activity_main.xml
file:
android:layout_width="match_parent"
Figure 2-3 
Figure 2-4 
www.it-ebooks.info


 
Recipe 2.3 using Radio Buttons

47
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/rdbGp1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:id="@+id/rdb1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_launcher"
android:text="Option 1" />
android:id="@+id/rdb2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/ic_launcher"
android:text="Option 2" 
android:checked="true"/>


The 
RadioButton
element represents a two-state button that can be either checked or unchecked. 
Once a radio button is checked, it cannot be unchecked by tapping on it. Instead, radio buttons are 
contained within a 
RadioGroup
element, which contains a set of radio buttons. Checking one radio 
button in a radio group unchecks the rest of the radio buttons in the same group. 
Figure 2-5 shows the result of the preceding code snippet in the Android emulator. 

Download 32,34 Mb.

Do'stlaringiz bilan baham:
1   ...   43   44   45   46   47   48   49   50   ...   56




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish