2010-02-04 97 views
0

我刚刚更新了我的应用程序,我收到了更新它的人的一些奇怪的投诉。我只得到非股票安卓手机(制造商已修改的手机...... HTC手机,cliq,脉冲等),其他手机,如Droid,Nexus的工作正常的投诉。我的应用程序(相框豪华版)中有一个列表,其中包含一个图像查看,文本查看,查看(间隔)和复选框。受影响的手机会发生什么事情,行开始重叠,它切断了上半部分。我的布局代码如下,我拉着我的头发,在这个布局中我可能会犯错。 为什么在一些手机上而不是在其他手机上工作?任何帮助,将不胜感激。列表视图行重叠问题

行布局:

<?xml version="1.0" encoding="UTF-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
<ImageView 
    android:id="@+id/photorowIcon" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical" 
    android:paddingTop="10dp" 
    android:paddingBottom="10dp" 
    android:paddingRight="5dp" 
    /> 
<TextView 
    android:id="@+id/photorowText" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical" 
    /> 
<View 
    android:layout_width="0px" 
    android:layout_height="wrap_content" 
    android:layout_weight="1"/> 
<CheckBox 
    android:id="@+id/photorowCheckBox" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical" 
    android:focusable="false" 
    android:focusableInTouchMode="false" 
    /> 
</LinearLayout> 

布局行插入:

<?xml version="1.0" encoding="UTF-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"> 
<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/title1_gradient" 
    android:orientation="vertical"> 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Select Photos to Display:" 
    android:textSize="20sp" 
    android:textStyle="bold" 
    android:textColor="#FFFFFFFF" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:paddingTop="5dp" 
    /> 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/folderName" 
    android:textSize="15sp" 
    android:textStyle="bold" 
    android:textColor="#FFFFFFFF" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:paddingBottom="5dp" 
    /> 
    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1px" 
     android:background="#406C6C6C"/> 
    </LinearLayout> 
<ListView 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="0px" 
    android:layout_weight="1" 
    android:drawSelectorOnTop="false" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    /> 
<LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:layout_gravity="bottom">  
    <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:layout_gravity="bottom" 
      android:background="#FF6C6C6C" 
      android:padding="5dp"> 
      <Button 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/ok" 
       android:text="OK"/> 
    </LinearLayout> 
</LinearLayout> 
</LinearLayout> 
+1

你有你的用户所看到的效果截图? – CommonsWare 2010-02-04 18:15:18

回答

0

我将无法找准你的问题,但我确实知道,布局(可惜!)之间可以改变Android的次要版本。我看到一些问题从1.5到1.6,特别是列表中的布局。更有问题的是模拟器没有正确模拟这个事实,这使得这很难解决。我记得它与重力有关,所以我会玩这个部分。此外,尝试使用RelativeLayout作为比嵌套的linearlayouts更少的资源饥饿。

另请尝试使用SDK,layoutopt和Hiearhcy Viewer中的布局工具。

1

变化乌尔ListView的标签属性

android:layout_height="fill_parent" 
3

我有同样的问题。在2个Verizon Eris以及1.5模拟器中显而易见。它不会出现在G1(v1.6),moto Droid(2.0.1)或任何模拟器中1.6+

它出现在绑定到ListActivity的ListView中,以及垂直定向的LinearLayout中。在这两种情况下,我都将RelativeLayouts放入每个对象中,并且我一直在丢失它们的顶部

我使用了hierarchyViewer,将每个该死的东西都分解了,然后旋转。最后,我在手动将RelativeLayout上的minHeight设置为比所示内容更大的事情之后,终于明白了问题不仅在于SIZING,而且在于SHIFTING。RelativeLayout中的所有内容都被推到了视图的顶部。

这使我的精神重温圣杜斯的回答上面:在RelativeLayout的“是与重力”

(住房每个表的“行”),我把:

android:gravity="center_vertical" 

这造成了巨大的差异。

现在,我行仍 1.5较窄,但它们是可用的,而且我可以保持它