What is the difference between LinearLayout and LinearLayoutCompat

I know that it LinearLayoutCompatwas implemented to give us several new methods that were added at higher levels of android to lower levels of android.

My problem is this method:

 linearLayout.setPaddingRelative

What was added in API 17, but we must use it in a lower API using the following code:

 linearLayoutCompat.setPaddingRelative

But my Android Studio still shows the following error.

 Call requires API level 17 (current min is 15): android.view.View#setPaddingRelativ

So what is the difference between LinearLayoutand LinearLayoutCompat?

+4
source share
1 answer

LinearLayoutCompat , API (, ). LinearLayout LinearLayoutCompat , LinearLayout API.
: , View (LinearLayout View). View API, API 17 LinearLayout, LinearLayoutCompat.

API, ViewCompat ViewCompat.setPaddingRelative(View view, ...).

+6

Source: https://habr.com/ru/post/1657132/


All Articles