ImageButton
Explicación del concepto de ImageButton.
DEFINICIÓN
Last updated
Explicación del concepto de ImageButton.
Last updated
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp"
android:orientation="vertical">
<ImageButton
android:id="@+id/ibtEjemplo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_car"
android:backgroundTint="@color/purple_200"/>
</LinearLayout>package com.example.android.appdeejemplo
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageButton
import android.widget.Toast
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val bEjemplo = findViewById<ImageButton>(R.id.ibtEjemplo)
bEjemplo.setOnClickListener {
Toast.makeText(this, "Botón Pulsado", Toast.LENGTH_SHORT).show()
}
}
}