2010-02-04 93 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較窄,但它們是可用的,而且我可以保持它