I have always used separate layout folders to support features available in newer API versions. One of these features is layout transition
using animateLayoutChanges
. For this, I create folders layout
and layout-v11
and their landscape counterparts.
Today, I found out that having animateLayoutChanges
in xml does not raise a flag on API versions < 11. Why is this? Testing on API 8, layout animations were not present, but the app didn't crash either.
Does this mean that I don't have to create separate layout folders (and separate xml files) to support this feature?
To make things clear, here's an example of what I am doing:
res/layout/activity.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMainContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/tvMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Example"
android:textColor="@color/some_color"
android:textSize="@dimen/text_size_message" />
....
....
</LinearLayout>
res/layout-v11/activity.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMainContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:animateLayoutChanges="true" > <<<<<<<<<<<<====================
<TextView
android:id="@+id/tvMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Example"
android:textColor="@color/some_color"
android:textSize="@dimen/text_size_message" />
....
....
</LinearLayout>