仅当指定了minSdkVersion时,Gridview问题才会出现

问题描述

|| 我正在使用Gridview显示一些缩略图。我遇到的一个奇怪的问题是,如果清单中未指定android:minSdkVersion,则缩略图之间的间距应适当,但是如果我指定minSdkVersion(需要4个或更多),则缩略图将水平合并。 这个问题仅出现在我的测试电话T Mobile Pulse mini上,而在模拟器上却没有出现此类问题。 感谢对此提出的任何明智建议。 XML如下所示。
<?xml version=\"1.0\" encoding=\"utf-8\"?>

<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"
    android:orientation=\"vertical\"
    android:layout_width=\"fill_parent\"
    android:layout_height=\"fill_parent\"
    >

    <!--thumbnails-->
    <GridView
        android:id=\"@+id/gridview\"
        android:layout_width=\"fill_parent\" 
        android:layout_height=\"fill_parent\"
        android:columnWidth=\"90dp\"
        android:numColumns=\"auto_fit\"
        android:verticalSpacing=\"10dp\"
        android:horizontalSpacing=\"10dp\"
        android:stretchMode=\"none\" 
        android:gravity=\"center\"
    />

</LinearLayout>
    

解决方法

        API版本4之后提供属性“ auto_fit \”。 所以在行
android:numColumns=\"auto_fit\"
您将必须指定列数。 有关更多信息,请参阅 http://developer.android.com/reference/android/widget/GridView.html#AUTO_FIT     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...