2013-03-11 21 views
5

Özel görünümümü yatay kaydırma görünümüne eklemeye çalıştığımda gösterilmiyor. ama aynı özel görünüm, Bağıl ve Doğrusal Düzen gibi başka bir düzende gösterilir. BuÖzel görünüm Yatay kaydırma görünümünde gösterilmiyor Çalışmıyor

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scroll" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    android:orientation="horizontal" 
    > 

</HorizontalScrollView> 

gibi

layout=new LinearLayout(this); 
     layout.setBackgroundColor(Color.YELLOW); 
     layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.MATCH_PARENT)); 
     layout.setOrientation(LinearLayout.HORIZONTAL); 

     l = new PredicateLayout(this); 
//  l.sendtext(info); 
     for(int j=0;j<info.length;j++) 
     { 

      LinearLayout aa=new LinearLayout(this); 
      aa.setOrientation(LinearLayout.VERTICAL); 
      t = new TextView(this); 
       t.setText(info[j]); 
       t.setBackgroundColor(Color.GREEN); 
       t.setTextSize(i); 
       t.setWidth(screenwidth/2); 
       aa.addView(t); 
       l.addView(aa, new PredicateLayout.LayoutParams(0, 0)); 

     } 

     layout.addView(l); 
     scroll.addView(layout); 

My XML görünüm ayrıca herhangi biri bana yardımcı olabilir

test=(PredicateLayout)findViewById(R.id.predicate_layout); 

for(int j=0;j<info.length;j++) 
     { 

      LinearLayout aa=new LinearLayout(this); 
      aa.setOrientation(LinearLayout.VERTICAL); 
      t = new TextView(this); 
       t.setText(info[j]); 
       t.setBackgroundColor(Color.GREEN); 
       t.setTextSize(i); 
       t.setWidth(screenwidth/2); 
       aa.addView(t); 
       test.addView(aa, new PredicateLayout.LayoutParams(0, 0)); 

     } 

gibi bu

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scroll" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    android:orientation="horizontal" 
    > 

    <com.test.app.PredicateLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     android:id="@+id/predicate_layout" 
     > 

    </com.omnion.bible.PredicateLayout> 
</HorizontalScrollView> 

kod bakmak gibi çalıştı. Şimdiden teşekkürler. özel oluşturmak istediğiniz Düzen içindeki görünümü eklemek gerekir görüntülemek eğer

+0

gibi özel düzeni koy .. – Janmejoy

cevap

1

bu

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scroll" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:fillViewport="true" 
    android:orientation="horizontal" 
    > 
<LinearLayout 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"> 
    <com.test.app.PredicateLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     android:id="@+id/predicate_layout" 
     > 

    </com.omnion.bible.PredicateLayout> 
</LinearLayout> 
</HorizontalScrollView> 
İlgili konular