Arnawli bilimlendiriw ministrligi



Download 340,45 Kb.
bet4/6
Sana10.04.2022
Hajmi340,45 Kb.
#541302
1   2   3   4   5   6
Bog'liq
Satbaeva Dilfuza (Mobil) (1)[1]

android: tintMode: ko’rinislerge ren’ qollaw ushin isletiletug’in rejim

ImageView klasinin’ ayrim tiykarg’i usullari:

  • Drawable getDrawable(): Berilgan ImageView menen baylanisqan Drawable resursin qaytaradi (ya’ki ImageView ushin heshqanday resurs ornatilmag’an bolsa null )

  • ImageView.ScaleType getScaleType(): ImageView elementinin’ shegaralarina salistirg’anda ko’rinis qanday masshtablang’anlig’in ko‘rsetiwshi ImageView.ScaleType sanalg’an ma’nisin qaytaradi.

  • void setImageDrawable(Drawable drawable): Drawable obiekti ja’rdeminde ko’rinis resursin ornatadi

  • void setImageResource(int resId): Drawable ning resurs identifikatorinan paydalang’an halda ko’rinis resursin ornatadi

  • void setImageURI(Uri uri):  Usi resurstin’ Uri ma’nzilinen paydalang’an halda ko’rinis resursin ornatadi

  • void setScaleType(ImageView.ScaleType scaleType): ko’rinis masshtabin ornatadi

  • void setImageAlpha(int alpha): ko’rinistin’ tiniqlig’in ornatadi - 0,0 den 1,0 ge shekem bolg’an ma’nis

Ma’selen, activity_main.xml faylinda android:scaleType atributi uchun FIT_XY ma’nisin ornatiw:

1
2
3

4


5
6
7
8
9
10
11
12
13
14
15
16


xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dubi2"
android:scaleType="fitXY"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"/>




Na’tiyjede, ko’rinis vertikal ha’m gorizontal tu’rde soziladi:



Salistiriw ushin, android:scaleType="center" menen uqsas misal:





Java kodindag’i uqsas misal:



1
2
3
4

5
6
7


8
9
10
11

12
13


14
15

16
17


18
19

20
21


22


23

24


25
26
27
28
29
30

package com.example.viewapp;


import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.os.Bundle;
import android.widget.ImageView;


public class MainActivity extends AppCompatActivity {


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);


ConstraintLayout constraintLayout = new ConstraintLayout(this);
ImageView imageView = new ImageView(this);
imageView.setImageResource(R.drawable.dubi2);
// задаем масштабирование
imageView.setScaleType(ImageView.ScaleType.FIT_XY);


ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams
(ConstraintLayout.LayoutParams.WRAP_CONTENT, ConstraintLayout.LayoutParams.WRAP_CONTENT);
layoutParams.leftToLeft = ConstraintLayout.LayoutParams.PARENT_ID;
layoutParams.topToTop = ConstraintLayout.LayoutParams.PARENT_ID;
imageView.setLayoutParams (layoutParams);
contraintLayout.addView(imageView);


setContentView(contraintLayout);
}
}




Download 340,45 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




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