AppCompatToggleButton

public class AppCompatToggleButton
extends ToggleButton implements TintableBackgroundView, EmojiCompatConfigurationView

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.Button
         ↳ android.widget.CompoundButton
           ↳ android.widget.ToggleButton
             ↳ androidx.appcompat.widget.AppCompatToggleButton


A ToggleButton which supports compatible features on older versions of the platform, including:

This will automatically be used when you use ToggleButton in your layouts. You should only need to manually use this class when writing custom views.

Summary

Inherited constants

Inherited fields

Public constructors

AppCompatToggleButton(Context context)
AppCompatToggleButton(Context context, AttributeSet attrs)
AppCompatToggleButton(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

boolean isEmojiCompatEnabled()
void setAllCaps(boolean allCaps)
void setBackgroundDrawable(Drawable background)
void setBackgroundResource(int resId)
void setEmojiCompatEnabled(boolean enabled)

Configure emoji fallback behavior using EmojiCompat.

void setFilters(InputFilter[] filters)

Protected methods

void drawableStateChanged()

Inherited methods

Public constructors

AppCompatToggleButton

public AppCompatToggleButton (Context context)

Parameters
context Context

AppCompatToggleButton

public AppCompatToggleButton (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

AppCompatToggleButton

public AppCompatToggleButton (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

isEmojiCompatEnabled

public boolean isEmojiCompatEnabled ()

Returns
boolean

setAllCaps

public void setAllCaps (boolean allCaps)

Parameters
allCaps boolean

setBackgroundDrawable

public void setBackgroundDrawable (Drawable background)

Parameters
background Drawable

setBackgroundResource

public void setBackgroundResource (int resId)

Parameters
resId int

setEmojiCompatEnabled

public void setEmojiCompatEnabled (boolean enabled)

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)

setFilters

public void setFilters (InputFilter[] filters)

Parameters
filters InputFilter

Protected methods

drawableStateChanged

protected void drawableStateChanged ()