android API 10 中的网格布局支持 [英] Grid Layout support in android API 10

查看:24
本文介绍了android API 10 中的网格布局支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个目标 API 为 15 的应用程序.布局包括网格布局.现在,当我将 Target API 更改为 10 时,我遇到了网格布局和另一个元素空间"的问题.Eclipse 提示我下载 2.3.3 的支持库,我做了...但仍然有问题.

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 another element 'space'. Eclipse prompts me to download a supporting library for 2.3.3, Which i did... But still having the issue.

推荐答案

GridLayout 确实已向后移植以兼容 API 级别 7 及更高版本.它是(某种程度上)支持库的一部分.下载支持库后,您将在位于以下位置的本地 sdk 文件夹中找到一个 Android 库项目:

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:

<sdk_folder>extrasandroidcompatibilityv7gridlayout

将其设置为您正在处理的项目的依赖项.之后,您需要将整个项目的引用从 15 级版本更改为此兼容性版本,以支持 ICS 之前的设备.在布局文件中,将 xml 从 GridLayout 更改为 android.support.v7.widget.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.

关于 Space 小部件:我实际上还没有使用过这个(还),但它似乎可以通过在现有视图上设置边距/填充或添加您自己的完全透明的通用 View 来替换.

这篇关于android API 10 中的网格布局支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆