0

Hy,

When using views and atributtes like the next ones configuring an android layout:

    <ImageView
    android:src="@android:drawable/ic_partial_secure"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:id="@+id/imageView" />
  • The number of views and values of these atributtes depend on the api level you are working on?
  • If it does, how can I know I am not using an atributte or a view that will not be present on an Android device with an api which not contains this atributte?

Thanks

fernando1979
  • 1,727
  • 2
  • 20
  • 26

1 Answers1

1

Yes, there are some attributes that require a min API, take a look at this: android:actionBarStyle requires API level 11

if it does and your min API level (in your build.gradle) is too low then android will tell you.

Community
  • 1
  • 1
T.S
  • 911
  • 8
  • 24
  • I know with java code you can do some checkings if you are using features from a higher api level in order to use them only if the android version supports them but working with xml is not possible to do these checkings right? I mean android wont let you to use features from a higher api level throwing an error, right? – fernando1979 Oct 20 '16 at 21:51
  • 1
    No, android won't throw an error, if you set your min API to 10, and use the attribute fontFamily (that requires API 16 or higher) in your TextView , then you get a warning, but you can still use this attribute, it will just be ignored by android on lower API devices. more info: https://developer.android.com/training/basics/supporting-devices/platforms.html#version-codes – T.S Oct 20 '16 at 22:20