Kotlin for Android Developers



Download 1,04 Mb.
Pdf ko'rish
bet108/125
Sana11.08.2021
Hajmi1,04 Mb.
#144654
1   ...   104   105   106   107   108   109   110   111   ...   125
Bog'liq
Kotlin for Android Developers Learn Kotlin the Easy Way While Developing an Android App ( PDFDrive )

initToolbar()
5
6
forecastList.layoutManager = LinearLayoutManager(this)
7
attachToScroll(forecastList)
8
9
async {
10
val result = RequestForecastCommand(94043).execute()
11
uiThread {
12
val adapter = ForecastListAdapter(result) {
13
startActivity(DetailActivity.ID to it.id,
14
DetailActivity.CITY_NAME to result.city)
15
}
16
forecastList.adapter = adapter
17
toolbarTitle = "${result.city} (${result.country})"
18
}
19
}
20
}
DetailActivity
also needs some layout modifications:


24 Interfaces and Delegation
119
1
2
xmlns:android="http://schemas.android.com/apk/res/android"
3
xmlns:tools="http://schemas.android.com/tools"
4
android:layout_width="match_parent"
5
android:layout_height="match_parent"
6
android:orientation="vertical">
7
8

9
10
11
android:layout_width="match_parent"
12
android:layout_height="wrap_content"
13
android:orientation="horizontal"
14
android:gravity="center_vertical"
15
android:paddingTop="@dimen/activity_vertical_margin"
16
android:paddingLeft="@dimen/activity_horizontal_margin"
17
android:paddingRight="@dimen/activity_horizontal_margin"
18
tools:ignore="UseCompoundDrawables">
19
....
20

21
22

The
toolbar
property is specified the same way.
DetailActivity
will initialise the toolbar too, set
the title and enable the up navigation icon:
1
override fun onCreate(savedInstanceState: Bundle?) {
2
super.onCreate(savedInstanceState);
3
setContentView(R.layout.activity_detail)
4
5
initToolbar()
6

Download 1,04 Mb.

Do'stlaringiz bilan baham:
1   ...   104   105   106   107   108   109   110   111   ...   125




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