2010-08-20 12 views
5

Geçmiş listesi için FastScroll'u kullanmak ve bölümler için tarihleri ​​kullanmak istiyorum ancak uyarı iletişim kutusu (kişilerdeki harfleri gösterir) metnin boyutuna sığmayacak kadar uzatmıyor (ay ve gün orada göstermek istiyorum).FastScroll uyarısını yeniden boyutlandır iletişim kutusu

Nasıl yeniden boyutlandırabilirim?

+0

Herhangi bir gelişme var mı? Önerimi denediniz mi? – gary

cevap

1

Çözümüm. Dahili Fastscroll özelliğini devre dışı bıraktık ve küçük değişiklikler yaparak this kodunu kullanın. Değişken mOverlaySize, bölüm uyarılarının boyutundan sorumludur.

1

AlertDialog sınıfında setView'u kullanmak kadar basit bir şey olabilir mi? (.xml ile ilgili bazı düzenlemelerin yanı sıra). İlk olarak, here'dan setView numaralı telefondan bilgi aldım.

public void setView (View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom) 

Set the view to display in that dialog, specifying the spacing to appear around that view.  
Parameters: 
view The view to show in the content area of the dialog 
viewSpacingLeft Extra space to appear to the left of view 
viewSpacingTop Extra space to appear above view 
viewSpacingRight Extra space to appear to the right of view 
viewSpacingBottom Extra space to appear below view 

Ve burada bazı SDK'nın örnek kod setView kullanır (AlertDialogSamples.java) bulunuyor. metnin (alert_dialog_text_entry.xml) etrafında marjları ekler gibi

case DIALOG_TEXT_ENTRY: 
      // This example shows how to add a custom layout to an AlertDialog 
      LayoutInflater factory = LayoutInflater.from(this); 
      final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); 
      return new AlertDialog.Builder(AlertDialogSamples.this) 
       .setIcon(R.drawable.alert_dialog_icon) 
       .setTitle(R.string.alert_dialog_text_entry) 
       .setView(textEntryView) 
       .setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { 
        public void onClick(DialogInterface dialog, int whichButton) { 

         /* User clicked OK so do some stuff */ 
        } 
       }) 
       .setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() { 
        public void onClick(DialogInterface dialog, int whichButton) { 

         /* User clicked cancel so do some stuff */ 
        } 
       }) 
       .create(); 
     } 
     return null; 

Ve son olarak, xml dosyasına bazı görünüyor.

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

    <TextView 
     android:id="@+id/username_view" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_marginLeft="20dip" 
     android:layout_marginRight="20dip" 
     android:text="@string/alert_dialog_username" 
     android:gravity="left" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

Yardım edin.

+0

Bu, FastScroll'a nasıl uygulanabilir? Geç cevap için üzgünüm. –

İlgili konular