Close
android_logo_520

Androidda GiperHavola

Giperhavola (rus. Гиперссылка, ing. Hyperlink) – bu asosan matn (rasm, fayl)ning ma`lum bir qismiga bosilganda boshqa link (havola)ga bog`lanish, murojaat qilish, o`tish uchun xizmat qiladi. Giperhavola foydalanilgan o`rinlarda ushbu belgini uchratasiz va matn ko`k rangda, tagiga chiziq chizilgan bo`ladi.

hyper_link_exam
Misol uchun, shu ko’rinishda bo’ladi.

Giperhavolani Android Studio muhitida TextView ga qanday qo`yilishini ko`rib chiqamiz.

1. values/strings.xml faylga quyidagi kodlarni kiriting. (href’ga o`zingiz istagan linkni quyishingiz mumkin.

  1. <string name="linktoside">
  2. <a href="https://telegram.me/EnglishPlyus">@EnglishPlyus</a>
  3. </string>

2. Endi layout/fragment_about.xml ga stringni chaqiring.

  1. <TextView android:layout_width="match_parent"
  2. android:layout_height="wrap_content"
  3. android:text="@string/linktoside"
  4. android:textSize="20sp"
  5. android:paddingLeft="15dp"
  6. android:id="@+id/text1" />

3. Javada

  1. // ushbu buyruqni joylang
  2. text.setMovementMethod(LinkMovementMethod.getInstance());

Batafsil quyida:

  1. @Override
  2. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  3. View view = inflater.inflate(R.layout.fragment_about, container, false);
  4. TextView text =(TextView) view.findViewById(R.id.text1);
  5. text.setMovementMethod(LinkMovementMethod.getInstance());
  6. return view;
  7. }
4. Natija
(406 marta o'qilgan, bugun 1 marta o'qildi)

O'xshash maqolalar: