Grid Layout support in android API 10

前端 未结 3 1025
别跟我提以往
别跟我提以往 2020-12-03 01:25

I had developed an app with target API as 15. The layout includes a grid layout. Now when i am changing the Target API to 10 I am getting issues with the grid Layout and ano

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 01:56

    GridLayout has indeed been backported to be compatible with API level 7 and up. It's (sort of) part of the support library. After you've downloaded the support library, you'll find an Android library project in your local sdk folder located at:

    \extras\android\compatibility\v7\gridlayout
    

    Set it up as dependency of the project you're working on. After that, you'll need to change the references throughout your project from the level 15 version to this compatibility one in order to support pre-ICS devices. In the Layout files change your xml from GridLayout to android.support.v7.widget.GridLayout. Usage should be similar, if not identical.

    Regarding the Space widget: I haven't actually used this one (yet), but it appears to be something that could be replaced by either setting margin/padding on existing views or adding in your own generic View that is completely transparent.

提交回复
热议问题