Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Android Framework widgets and their AppCompat version

I have lately noticed that there are AppCompat versions of most View types in Android, for example ListView / ListViewCompat, Button / AppCompatButton etc.

For these more simple Views (not counting for example SwitchCompat), what are the difference between them and the Android Framework version? I have not found any documentation on this matter...

I'm interested in knowing the consequences of choosing either version and if there are any advantages in chosing one over the other.

Specifically:

  • Difference between ListView and ListViewCompat
  • Difference between Button / AppCompatButton
  • Difference between ImageView / AppCompatImageView
  • Difference between EditText / AppCompatEditText
  • Difference between TextView / AppCompatTextView

I changed from normal to AppCompat versions with the expectation that colors would be used from the theme and look the same on Lollipop and pre-lollipop, but it rather had the opposite effect on some views (such as ListView)

like image 812
Joakim Avatar asked Jan 26 '16 08:01

Joakim


People also ask

What is android AppCompat?

An Android support library that enables the use of the ActionBar and Material Design specific implementations such as Toolbar for older devices down to Android v2. 1. Developed by. Google.

What is Appcompat ImageView?

androidx.appcompat.widget.AppCompatImageView. A ImageView which supports compatible features on older versions of the platform, including: Allows dynamic tint of its background via the background tint methods in androidx.


1 Answers

AppCompat provides consistent UI support for older versions of APIs back to API v7. from Documentation

The full list of tint aware widgets available in appcompat

AppCompatAutoCompleteTextView AppCompatButton AppCompatCheckBox AppCompatCheckedTextView AppCompatEditText AppCompatMultiAutoCompleteTextView AppCompatRadioButton AppCompatRatingBar AppCompatSpinner AppCompatTextView 

ListViewCompat is subclass of ListView same others


edited:

why both class available in framework or How Android Support Library work?

like image 100
Dhaval Parmar Avatar answered Sep 23 '22 13:09

Dhaval Parmar