V4 and V7 on Android

Asked

Viewed 337 times

3

Why in some examples on the Internet, we find something like this:

<android.support.v4.view.ViewPager/>

<android.support.v7.view.ViewPager/>

What would this V4 and V7 be?

And in this example,

android.support.design.widget

What would this support?

  • I believe it’s the "version".

2 answers

4

In short, they are the Support Libraries android.

Android features numerous versions, and in each new version new Apis are created. However, your application is usually not only developed for the newer version. With this, Google has the Support Library Features.

v4 Support Libraries

According to Google, it is:

These Libraries are Designed to be used with Android 2.3 (API level 9) and Higher. They include the largest set of Apis Compared to the other Libraries, including support for application Components, user interface Features, Accessibility, data Handling, network Connectivity, and Programming Utilities.

In translation, these libraries are designed to be used with Android 2.3 (API 9) and higher. They include the largest number of Apis compared to other libraries.

To better understand what she contemplates, see package reference

v7 Support Libraries

According to Google, it is:

This library adds support for the Action Bar user interface design Pattern. This library includes support for material design user interface implementations.

In translation, this library adds support for implementations of Material Design.

Some of the main classes included are:

Among others, such as:

I must point out that the v7 library depends on the v4 library.

More Supports Libbrarys

In addition to the librarys mentioned above, Google has several others to assist development, such as:

For more details, you can check the Support Library Revision History google.

  • But if I set on Android, that the minimum version to run my App is 5, so using the same do not make sense?

  • @Luhhh If all you need is in Android version 5 (API: 21) and will not be compatible with lower versions, do not need to use.

  • @Luhhh But it is worth noting that Google already has two more versions of Android above the 5.

1

What would this V4 and V7 be?

Although the current documentation states that both are to be used as of version 2.3 (API 9), the reason for the notation Vnn was to indicate which version of the SDK is retro-compatible(1).

Thus, V4 indicates that it can be used on devices Android 1.6+(API Level 4+) and the V7 in Android 2.1+(API Level 7+).

I do not know if the reason for the change of the documentation is only because there are now very few devices with Android 1.6 and 2.1 and they are not compatible with the Google Play Store, or is because really the compatibility is only from 2.3.

What would this support?

Support, in English, that is to say support, support, help.

android.support.design.widget is the package name where some of the widget of Material Design which can be used in versions prior to Android 5.

He exists in the Android Design Support Library whose function is to allow devices with Android versions below 5 "support" the Material Design.

(1) - I could not retrieve the old documentation but there are answers in Soen that contain excerpts or experts like the Commonsware confirming.

Note that android.support.v7.view.ViewPager there is no.

  • I read that answer, but as the documentation showed something different, I understood that something was changed so it wouldn’t work any more, but if it does, I owe @Leonardodias an apology, because the documentation said something different. But, great answer

  • @Randrade The reason for the V4 and V7 notation is what I gave in the answer. Whether libraries continue to be compatible with these versions I do not know, but I think so. It is a matter of testing.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.