Try to search your question here, if you can't find : Ask Any Question Now ?

Inline sdk version check in Android XML?

HomeCategory: stackoverflowInline sdk version check in Android XML?
Avatarpushpa asked 3 months ago

Sometimes, when I want to add SDK 21+ feature to my layout, I need to create whole layout in another file. It’s heavy to me because I want to do or check everything in one layout. More of layouts are looking complex and hard to manage. Instead of having two layouts for different SDK versions, can I do something like this:

    <compatibility sdk_higher_than="21">
        android:elevation="xdp" //my problem not about the elevation. Its just an example that pops in my mind about the compatibility.
    app:srcCompat="@drawable/ic_x" />

I can make this stuff programmatically but when I should see the view instantly on designer, making it programmatically is not a good way for me. If there is a good practice or idea for this problem can anybody illuminate me?

1 Answers
Best Answer
AvatarAmit answered 3 months ago
Your Answer

4 + 14 =

Popular Tags

WP Facebook Auto Publish Powered By :