2014-05-15 3 views
0

J'ai un ListView que je remplis avec un ArrayAdapter.Its fonctionne très bien la plupart des appareils.Mais j'ai un périphérique karbonn (320x480) qui ne peut pas afficher la liste.Mon application contient de nombreux listview ils s'affichent correctement sur karbonn.affichage de la liste ne pas afficher sur certains périphériques

Mon fichier .xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#e6f0f5" 
    tools:context=".Save_educationActivity" > 



    <RelativeLayout 
     android:id="@+id/btnlayout" 
     android:layout_width="match_parent" 
     android:layout_height="47dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:background="#4791FF" 
     android:orientation="horizontal" > 


     <ImageButton 
      android:id="@+id/xibtn_save_education" 
      android:layout_width="45dp" 
      android:layout_height="45dp" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginRight="5dp" 
      android:background="#4791FF" 
      android:src="@drawable/ic_action_save" /> 

     <ImageButton 
      android:id="@+id/xibtn_back_to_education" 
      android:layout_width="45dp" 
      android:layout_height="45dp" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginLeft="5dp" 
      android:background="#4791FF" 
      android:src="@drawable/ic_action_back" /> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/btnlayout" 
     android:layout_marginTop="3dp" 
     android:text="@string/Education_title" /> 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView1" > 

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

      <TextView 
       android:id="@+id/textView2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text=" Course Name" 
       android:textSize="18dp" 
       android:textStyle="bold" /> 


     </RelativeLayout> 
    </ScrollView> 

    <EditText 
     android:id="@+id/xedt_course" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/scrollView1" 
     android:ems="10" 
     android:inputType="textPersonName" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/xedt_course" 
     android:text="Date" 
     android:textSize="18dp" 
     android:textStyle="bold" /> 

    <TextView 
     android:id="@+id/TextView01" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/textView3" 
     android:text="Joining Date" 
     android:textSize="18dp" /> 

    <TextView 
     android:id="@+id/TextView02" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignBaseline="@+id/TextView01" 
     android:layout_alignBottom="@+id/TextView01" 
     android:layout_alignLeft="@+id/lvdate" 
     android:text="Leave Date" 
     android:textSize="18dp" /> 

    <EditText 
     android:id="@+id/jdate" 
     android:layout_width="140dp" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/TextView01" 
     android:ems="10" 
     android:hint="Joining Date" 
     android:inputType="textPersonName" /> 

    <EditText 
     android:id="@+id/lvdate" 
     android:layout_width="140dp" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/TextView02" 
     android:ems="10" 
     android:hint="Leaving Date" 
     android:inputType="textPersonName" > 

     <requestFocus /> 
    </EditText> 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_below="@+id/jdate" 
     android:layout_marginTop="10dp" 
     android:background="#ffffff" 
     android:orientation="horizontal" > 

     <Button 
      android:id="@+id/btn_education_desc" 
      android:layout_width="170dp" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="40dp" 
      android:background="@drawable/date_stroke" 
      android:text="Add Description" 
      android:textColor="#ffffff" 
      android:textSize="20dp" /> 

     <ImageButton 
      android:id="@+id/add_edu_desc" 
      android:layout_width="70dp" 
      android:layout_height="match_parent" 
      android:background="@drawable/date_stroke" 
      android:src="@drawable/ic_action_new" 
      android:visibility="gone" /> 
    </LinearLayout> 

     <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/linearLayout1"> 


      <ListView 
     android:id="@+id/lst_eductndesc" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_centerHorizontal="true" > 

    </ListView> 

    </RelativeLayout> 

</RelativeLayout> 

Répondre

0

Puisque vous utilisez RelativeLayouts et l'alignement de vos vues sous un autre, il est probable que la mise en page prolonge au-delà du bas de l'écran.

Je vous encourage à utiliser une combinaison différente de ViewGroups, par exemple en utilisant un LinearLayout orienté verticalement dans un ScrollView.

+0

Mais son beau travail un autre téléphone. J'ai un autre périphérique 320x480 fonctionne ce code. – Amol007

+0

Peut-être que la densité d'écran du "karbonn" est plus élevée. Tout cela n'est que spéculation, car je ne sais pas ce que vous voulez dire par "ça ne marche pas". –

2

Vous avez une disposition très buggée. Je vais vous montrer des erreurs visiterez:

<RelativeLayout 
    android:id="@+id/btnlayout" 
    android:layout_width="match_parent" 
    android:layout_height="47dp" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:background="#4791FF" 
    android:orientation="horizontal" > // there is no such attribute in relative layout 


    <ImageButton 
     android:id="@+id/xibtn_save_education" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="5dp" 
     android:background="#4791FF" 
     android:src="@drawable/ic_action_save" /> 

    <ImageButton 
     android:id="@+id/xibtn_back_to_education" 
     android:layout_width="45dp" 
     android:layout_height="45dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="5dp" 
     android:background="#4791FF" 
     android:src="@drawable/ic_action_back" /> 
</RelativeLayout> 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/btnlayout" 
    android:layout_marginTop="3dp" 
    android:text="@string/Education_title" /> 

<ScrollView 
    android:id="@+id/scrollView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" // which size of scroll view you expected here? It will grow with their content and never have scroll. 
    android:layout_below="@+id/textView1" > 

    <RelativeLayout // you don't need to have relative layout here. 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text=" Course Name" 
      android:textSize="18dp" 
      android:textStyle="bold" /> 


    </RelativeLayout> 
</ScrollView> 

<EditText 
    android:id="@+id/xedt_course" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/scrollView1" 
    android:ems="10" 
    android:inputType="textPersonName" /> 

<TextView 
    android:id="@+id/textView3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/xedt_course" 
    android:text="Date" 
    android:textSize="18dp" 
    android:textStyle="bold" /> 

<TextView 
    android:id="@+id/TextView01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/textView3" 
    android:text="Joining Date" 
    android:textSize="18dp" /> 

<TextView 
    android:id="@+id/TextView02" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBaseline="@+id/TextView01" 
    android:layout_alignBottom="@+id/TextView01" 
    android:layout_alignLeft="@+id/lvdate" 
    android:text="Leave Date" 
    android:textSize="18dp" /> 

<EditText 
    android:id="@+id/jdate" 
    android:layout_width="140dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/TextView01" 
    android:ems="10" 
    android:hint="Joining Date" 
    android:inputType="textPersonName" /> 

<EditText 
    android:id="@+id/lvdate" 
    android:layout_width="140dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/TextView02" 
    android:ems="10" 
    android:hint="Leaving Date" 
    android:inputType="textPersonName" > 

    <requestFocus /> 
</EditText> 

<LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="50dp" 
    android:layout_below="@+id/jdate" 
    android:layout_marginTop="10dp" 
    android:background="#ffffff" 
    android:orientation="horizontal" > 

    <Button 
     android:id="@+id/btn_education_desc" 
     android:layout_width="170dp" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="40dp" 
     android:background="@drawable/date_stroke" 
     android:text="Add Description" 
     android:textColor="#ffffff" 
     android:textSize="20dp" /> 

    <ImageButton 
     android:id="@+id/add_edu_desc" 
     android:layout_width="70dp" 
     android:layout_height="match_parent" 
     android:background="@drawable/date_stroke" 
     android:src="@drawable/ic_action_new" 
     android:visibility="gone" /> 
</LinearLayout> 

    <RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" // which height you expect here? It will have height the same as parent, but draws somewhere at the bottom. It will draw a large part of view outside of screen. 
    android:layout_below="@+id/linearLayout1"> 


     <ListView 
    android:id="@+id/lst_eductndesc" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerHorizontal="true" > 

</ListView> 

</RelativeLayout> 

Je pense que vous avez besoin de reformater votre mise en page du tout. Si vous voulez montrer à l'image ce que vous voulez réaliser et expliquer son comportement, je vous aiderai à écrire un xml plus efficace et plus propre.

Vous pouvez faire votre mise en page comme ceci:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#e6f0f5" 
    tools:context=".Save_educationActivity" 
    android:orientation="vertical"> 



    <RelativeLayout 
     android:id="@+id/btnlayout" 
     android:layout_width="match_parent" 
     android:layout_height="47dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:background="#4791FF" 
     android:orientation="horizontal" > // there is no such attribute in relative layout 


     <ImageButton 
      android:id="@+id/xibtn_save_education" 
      android:layout_width="45dp" 
      android:layout_height="45dp" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginRight="5dp" 
      android:background="#4791FF" 
      android:src="@drawable/ic_action_save" /> 

     <ImageButton 
      android:id="@+id/xibtn_back_to_education" 
      android:layout_width="45dp" 
      android:layout_height="45dp" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" 
      android:layout_marginLeft="5dp" 
      android:background="#4791FF" 
      android:src="@drawable/ic_action_back" /> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="3dp" 
     android:text="@string/Education_title" /> 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" // you must declare your height exactly here 
> 

      <TextView 
       android:id="@+id/textView2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text=" Course Name" 
       android:textSize="18dp" 
       android:textStyle="bold" /> 


    </ScrollView> 


    <EditText 
     android:id="@+id/xedt_course" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/scrollView1" 
     android:ems="10" 
     android:inputType="textPersonName" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/xedt_course" 
     android:text="Date" 
     android:textSize="18dp" 
     android:textStyle="bold" /> 

    <LinearLayout layout_width="match_parent" 
layout_height="wrap_content" 
android:orientation="horizontal"> 
    <LinearLayout layout_width="0dp" 
laout_weight="1" 
layout_height="wrap_content" 
android:orientation="vertical"> 

    <TextView 
     android:id="@+id/TextView01" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/textView3" 
     android:text="Joining Date" 
     android:textSize="18dp" /> 

<EditText 
     android:id="@+id/jdate" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:hint="Joining Date" 
     android:inputType="textPersonName" /> 

</LinearLayout> 
    <LinearLayout layout_width="0dp" 
laout_weight="1" 
layout_height="wrap_content" 
android:orientation="vertical"> 


    <TextView 
     android:id="@+id/TextView02" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Leave Date" 
     android:textSize="18dp" /> 
    <EditText 
     android:id="@+id/lvdate" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:ems="10" 
     android:hint="Leaving Date" 
     android:inputType="textPersonName" > 

    </EditText> 
</LinearLayout> 
</LinearLayout> 
    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_marginTop="10dp" 
     android:background="#ffffff" 
     android:orientation="horizontal" > 

     <Button 
      android:id="@+id/btn_education_desc" 
      android:layout_width="170dp" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="40dp" 
      android:background="@drawable/date_stroke" 
      android:text="Add Description" 
      android:textColor="#ffffff" 
      android:textSize="20dp" /> 

     <ImageButton 
      android:id="@+id/add_edu_desc" 
      android:layout_width="70dp" 
      android:layout_height="match_parent" 
      android:background="@drawable/date_stroke" 
      android:src="@drawable/ic_action_new" 
      android:visibility="gone" /> 
    </LinearLayout> 

      <ListView 
     android:id="@+id/lst_eductndesc" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
layout_weight="1" 
     android:layout_centerHorizontal="true" > 


</LinearLayout> 
+0

@ Amol007 vous pouvez poster un lien vers l'image sur un autre serveur. –

+0

je édite mon poste s'il vous plaît voir une fois. – Amol007

+0

ce travail sur un autre périphérique – Amol007

Questions connexes