AppCompatButton
class AppCompatButton : Button, TintableBackgroundView, TintableCompoundDrawablesView, EmojiCompatConfigurationView
| kotlin.Any | ||||
| ↳ | android.view.View | |||
| ↳ | android.widget.TextView | |||
| ↳ | android.widget.Button | |||
| ↳ | androidx.appcompat.widget.AppCompatButton |
EmojiAppCompatButton |
AppCompatButton widget enhanced with emoji capability by using |
MotionButton |
A MotionButton is an AppCompatButton that can round its edges. |
A Button which supports compatible features on older versions of the platform, including:
- Allows dynamic tint of its background via the background tint methods in
androidx.core.view.ViewCompat. - Allows setting of the background tint using
backgroundTintandbackgroundTintMode. - Allows setting of the font family using
fontFamily
This will automatically be used when you use Button in your layouts and the top-level activity / dialog is provided by appcompat. You should only need to manually use this class when writing custom views.
Summary
Public constructors |
|---|
AppCompatButton(context: Context) |
AppCompatButton(context: Context, attrs: AttributeSet?) |
AppCompatButton(context: Context, attrs: AttributeSet?, defStyleAttr: Int) |
Public functions |
|
|---|---|
ActionMode.Callback? |
|
Boolean |
|
Unit |
|
Unit |
|
Unit |
setAllCaps(allCaps: Boolean) |
Unit |
setBackgroundDrawable(background: Drawable?)This function is deprecated. |
Unit |
setBackgroundResource(resId: @DrawableRes Int) |
Unit |
setCustomSelectionActionModeCallback( |
Unit |
setEmojiCompatEnabled(enabled: Boolean)Configure emoji fallback behavior using EmojiCompat. |
Unit |
setFilters(filters: Array<InputFilter!>) |
Unit |
setSupportAllCaps(allCaps: Boolean)Sets the properties of this field to transform input to ALL CAPS display. |
Unit |
setTextAppearance(context: Context!, resId: Int)This function is deprecated. |
Unit |
setTextSize(unit: Int, size: Float) |
Protected functions |
|
|---|---|
Unit |
|
Unit |
|
Unit |
onTextChanged( |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
AppCompatButton
AppCompatButton(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
Public functions
getCustomSelectionActionModeCallback
fun getCustomSelectionActionModeCallback(): ActionMode.Callback?
isEmojiCompatEnabled
fun isEmojiCompatEnabled(): Boolean
| Returns | |
|---|---|
Boolean |
the current enabled state, set via |
onInitializeAccessibilityNodeInfo
fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo!): Unit
setCustomSelectionActionModeCallback
fun setCustomSelectionActionModeCallback(
actionModeCallback: ActionMode.Callback?
): Unit
setEmojiCompatEnabled
fun setEmojiCompatEnabled(enabled: Boolean): Unit
Configure emoji fallback behavior using EmojiCompat. When enabled, this View will attempt to use EmojiCompat to enabled missing emojis. When disabled, this View will not display missing emojis using EmojiCompat. EmojiCompat must be correctly configured on a device for this to have an effect, which will happen by default if a correct downloadable fonts provider is installed on the device. If you manually configure EmojiCompat by calling EmojiCompat init after this View is constructed, you may call this method again to enable EmojiCompat on this text view. For more information about EmojiCompat configuration see the emoji2 module.
| Parameters | |
|---|---|
enabled: Boolean |
if true, display missing emoji using EmojiCompat, otherwise display missing emoji using a fallback glyph "□" (known as tofu) |
setSupportAllCaps
fun setSupportAllCaps(allCaps: Boolean): Unit
Sets the properties of this field to transform input to ALL CAPS display. This may use a "small caps" formatting if available. This setting will be ignored if this field is editable or selectable. This call replaces the current transformation method. Disabling this will not necessarily restore the previous behavior from before this was enabled.
Protected functions
onLayout
protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit
onTextChanged
protected fun onTextChanged(
text: CharSequence!,
start: Int,
lengthBefore: Int,
lengthAfter: Int
): Unit