为什么ListView中的元素在不同的设备上显示不同?

丽莎·安妮(Lisa Anne)

我有一个ListView。

这是ListView项的XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/mainbackground"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/mainbackground"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:padding="10dp" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/signlist" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="0.8"
        android:background="@color/mainbackground"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/eventname"
                style="@style/N1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="10dp"
                android:text="mcdonalds" />

            <TextView
                android:id="@+id/textView2"
                style="@style/N1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=" " />

            <TextView
                android:id="@+id/eventtype"
                style="@style/N3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="" />
        </LinearLayout>

        <View
            android:layout_width="fill_parent"
            android:layout_height="@dimen/spazio" />

        <TextView
            android:id="@+id/eventdate"
            style="@style/N2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="10dp"
            android:text="Sun 15 Oct2013" />
    </LinearLayout>
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <View
        android:layout_width="fill_parent"
        android:layout_height="@dimen/spazio" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@color/lines" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#FFFFFF" />
</LinearLayout>

</LinearLayout>

现在,关键是相同的ListView在某些设备上显示不同(错误):

这就是它在Samsung Galaxy Ace(API 10)上的显示方式

而且还可以!!!

在此处输入图片说明


这就是它在我的Nexus 7(API 17)上的显示方式

而且也不行!!!:-(((

在此处输入图片说明

这是N1样式:

<style name="N1">
    <item name="android:textColor">#252525</item>
    <item name="android:typeface">sans</item>
    <item name="android:textSize">20sp</item>
</style>

这是“ values-sw600dp”的N1样式

<style name="N1">
    <item name="android:textColor">#252525</item>
    <item name="android:typeface">sans</item>
    <item name="android:textSize">30sp</item>
</style>
丽莎·安妮(Lisa Anne)

解决了!!

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/mainbackground"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/mainbackground"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:padding="10dp" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/signlist" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.8"
        android:background="@color/mainbackground"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/eventname"
                style="@style/N1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingLeft="10dp"
                android:text="mcdonalds" />

            <TextView
                android:id="@+id/textView2"
                style="@style/N1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=" " />

            <TextView
                android:id="@+id/eventtype"
                style="@style/N3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="" />
        </LinearLayout>

        <View
            android:layout_width="fill_parent"
            android:layout_height="@dimen/spazio" />

        <TextView
            android:id="@+id/eventdate"
            style="@style/N2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="10dp"
            android:text="Sun 15 Oct2013" />
    </LinearLayout>
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <View
        android:layout_width="fill_parent"
        android:layout_height="@dimen/spazio" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@color/lines" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="#FFFFFF" />
</LinearLayout>

</LinearLayout>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么两个不同的BLE适配器在扫描时显示不同的设备?

来自分类Dev

为什么Chrome检查器为SVG中的相同尺寸的元素显示不同的尺寸?

来自分类Dev

为什么数组 (collCells) 在 swift 中从不同的 ViewController 传递数组元素时显示为空?

来自分类Dev

为什么输入框在Ipad上显示如此不同但在chrome上却显示如此不同

来自分类Dev

为什么在不同设备上应用程序的内存使用量太不同?

来自分类Dev

为什么 FabricJS 在不同的设备/浏览器上缩放模式不同?

来自分类Dev

为什么在CentOS和RHEL上发现显示不同的顺序?

来自分类Dev

Bootstrap 5元素,在不同设备上的不同配置

来自分类Dev

NSTimeZone timeZoneWithName缩写在不同设备上显示不同的缩写

来自分类Dev

为什么不同的设备具有不同的wifi接收范围?

来自分类Dev

为什么文件权限在Python和bash中显示不同?

来自分类Dev

为什么网站 CSS 在浏览器中显示不同

来自分类Dev

React:如何调试为什么浏览器在 Chrome > Dev Tools 中显示的值与 HTML 元素不同?

来自分类Dev

Shopify 页面在移动设备上的显示方式与桌面设备不同

来自分类Dev

为什么输入框在Ipad上显示出如此不同但在chrome上却显示出如此不同

来自分类Dev

为什么我的应用程序在iPad上的显示与模拟器上的显示不同?

来自分类Dev

当没有滚动条时,为什么我的网站在移动设备上的显示方式有所不同

来自分类Dev

当没有滚动条时,为什么我的网站在移动设备上的显示方式有所不同

来自分类Dev

为什么在同一 Nexus 设备上运行的不同 Android 版本会有不同的二进制 blob

来自分类Dev

为什么 new Date(dateString) 在具有完全相同输入的不同设备上返回两个不同的日期?

来自分类Dev

如何在引导程序的不同设备中显示不同的项目

来自分类Dev

为什么iTtunes Search API的结果与iOS设备上的搜索结果顺序不同?

来自分类Dev

为什么在IPA和直接在设备上运行之间有不同的行为

来自分类Dev

为什么我的wifi IP地址与网络上的其他设备如此不同

来自分类Dev

为什么在 Xcode 故事板和设备上查看时导航栏不同?

来自分类Dev

为什么设计视图中的布局在实际设备上如此不同?

来自分类Dev

为什么元素宽度与位置不同:相对?

来自分类Dev

为什么数组末尾打印不同的元素?

来自分类Dev

为什么相同的文件在不同的操作系统中显示不同的大小

Related 相关文章

  1. 1

    为什么两个不同的BLE适配器在扫描时显示不同的设备?

  2. 2

    为什么Chrome检查器为SVG中的相同尺寸的元素显示不同的尺寸?

  3. 3

    为什么数组 (collCells) 在 swift 中从不同的 ViewController 传递数组元素时显示为空?

  4. 4

    为什么输入框在Ipad上显示如此不同但在chrome上却显示如此不同

  5. 5

    为什么在不同设备上应用程序的内存使用量太不同?

  6. 6

    为什么 FabricJS 在不同的设备/浏览器上缩放模式不同?

  7. 7

    为什么在CentOS和RHEL上发现显示不同的顺序?

  8. 8

    Bootstrap 5元素,在不同设备上的不同配置

  9. 9

    NSTimeZone timeZoneWithName缩写在不同设备上显示不同的缩写

  10. 10

    为什么不同的设备具有不同的wifi接收范围?

  11. 11

    为什么文件权限在Python和bash中显示不同?

  12. 12

    为什么网站 CSS 在浏览器中显示不同

  13. 13

    React:如何调试为什么浏览器在 Chrome > Dev Tools 中显示的值与 HTML 元素不同?

  14. 14

    Shopify 页面在移动设备上的显示方式与桌面设备不同

  15. 15

    为什么输入框在Ipad上显示出如此不同但在chrome上却显示出如此不同

  16. 16

    为什么我的应用程序在iPad上的显示与模拟器上的显示不同?

  17. 17

    当没有滚动条时,为什么我的网站在移动设备上的显示方式有所不同

  18. 18

    当没有滚动条时,为什么我的网站在移动设备上的显示方式有所不同

  19. 19

    为什么在同一 Nexus 设备上运行的不同 Android 版本会有不同的二进制 blob

  20. 20

    为什么 new Date(dateString) 在具有完全相同输入的不同设备上返回两个不同的日期?

  21. 21

    如何在引导程序的不同设备中显示不同的项目

  22. 22

    为什么iTtunes Search API的结果与iOS设备上的搜索结果顺序不同?

  23. 23

    为什么在IPA和直接在设备上运行之间有不同的行为

  24. 24

    为什么我的wifi IP地址与网络上的其他设备如此不同

  25. 25

    为什么在 Xcode 故事板和设备上查看时导航栏不同?

  26. 26

    为什么设计视图中的布局在实际设备上如此不同?

  27. 27

    为什么元素宽度与位置不同:相对?

  28. 28

    为什么数组末尾打印不同的元素?

  29. 29

    为什么相同的文件在不同的操作系统中显示不同的大小

热门标签

归档