Difference between Android Framework widgets and their AppCompat version

前端 未结 2 880
遇见更好的自我
遇见更好的自我 2021-02-18 21:50

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

2条回答
  •  误落风尘
    2021-02-18 22:22

    If you use AppCompatActivity, then AppCompatImageView will automatically be used when you use ImageView in your layouts.

    From the AppCompatImageView AppCompatEditText AppCompatButton

    Button vs AppCompatButton

    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.

    ImageView vs AppCompatImageView

    This will automatically be used when you use ImageView 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.

    EditText vs AppCompatEditText

    This will automatically be used when you use EditText 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.

    and the same rule is also valid for other appcompat views

提交回复
热议问题