🥄
One Library
  • 🤖onelib
  • 🏡Home
    • Overview
    • Setup Project
    • What's New
  • ☀️Fundamental
    • Basic Android
    • Data Flow
    • Dependency Injection
      • Hilt
      • Koin
  • 📿Layers
    • Data Layer
    • Domain Layer
    • Presentation Layer
  • 🪶Features
    • Views
      • Activity
      • Fragment
      • Bottom Sheet
      • Dialog
    • Adapters
      • Recycler Adapter
      • Filterable Adapter
      • Paging Adapter
      • Selectable Adapter
      • ViewPager Adapter
    • Firebase
      • One Firebase Auth
      • One Firebase Firestore
      • One Firebase Realtime
      • One Firebase Storage
    • Extension Functions
      • Any
      • Common
      • Context
      • Edittext
      • Image View
      • LiveData
      • OneMap
      • State Flow (Jetpack Compose)
      • View
    • Notification
    • One State View
    • Local Database
    • Permission
    • Validation
      • Passive Validator
      • Reactive Validator
      • Extension Validation
Powered by GitBook
On this page
  1. Features
  2. Extension Functions

Image View

Set Image Url

This function loads an image from a URL into an ImageView with a placeholder, error image, and optional center crop.

  • context: The context to use for Glide.

  • imageUrl: The URL of the image to load.

  • placeholder?: Resource ID of the placeholder image.

  • error?: Resource ID of the error image.

  • isCenterCrop?: Boolean to determine if the image should be center cropped.

? is nullable

Usage:

imageView.setImageUrl(this, "https://example.com/image.jpg", true)
imageView.setImageUrl(this, "https://example.com/image.jpg", R.drawable.placeholder, true)
imageView.setImageUrl(this, "https://example.com/image.jpg", R.drawable.placeholder, R.drawable.error, true)

This example demonstrates how to use the setImageUrl extension functions to load images into an ImageView with different options for placeholders, error images, and center cropping.

Last updated 11 months ago

🪶