2011-06-07 20 views
9

Uygulamamı başlattığımda, otomatik olarak ilk "EditText" kutusuna geçiyor. Bir kaydırma çubuğuna kurdum.ScrollView EditText içine atlar

Ve Kaydırma Çubuğunu çıkardığımda, "EditText" -Box'a atlamaz.

Neden "EditText" kutusuna tıklanıyor? Bundan hoşlanmıyorum o kutuya atlar. :/

İşte

Kodu: başıma sorunu çözüldü

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

<TextView 
    android:id="@+id/textView1" 
    android:layout_height="wrap_content" 
    android:text="Brutto- oder Nettobetrag eingeben:" 
    android:layout_width="fill_parent"> 
</TextView> 

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 

     <EditText 
      android:id="@+id/edt_betrag" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:inputType="numberDecimal"/> 

     <RadioGroup 
      android:id="@+id/rg_art" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <RadioButton 
       android:id="@+id/rb_art_netto" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Netto" 
       android:checked="true" /> 

      <RadioButton 
       android:id="@+id/rb_art_brutto" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Brutto" /> 

      <TextView 
       android:id="@+id/textView2" 
       android:layout_height="wrap_content" 
       android:layout_width="fill_parent" 
       android:text="Prozentsatz eingeben:"> 
      </TextView> 

      <EditText 
       android:layout_height="wrap_content" 
       android:layout_width="match_parent" 
       android:id="@+id/eigener_betrag" 
       android:inputType="numberDecimal"> 
      </EditText>  

     </RadioGroup> 

     <Button 
      android:id="@+id/Button01main" 
      android:text="Berechnen" 
      android:layout_height="50dip" 
      android:layout_width="fill_parent" 
      android:layout_gravity="center" android:layout_marginBottom="20dip"> 
     </Button> 

     <Button 
      android:layout_height="wrap_content" 
      android:id="@+id/zurueck" 
      android:text="Zurück" 
      android:layout_gravity="left" 
      android:layout_width="150dip"> 
     </Button> 

    </LinearLayout> 
</ScrollView> 

cevap

10
de eklendi

To s Bu programmactcally size böyle bir şey kod gerekir.

ScrollView scroll = (ScrollView)findViewById(R.id.my_scroll); 
    scroll.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); 
    scroll.setFocusable(true); 
    scroll.setFocusableInTouchMode(true); 
    scroll.setOnTouchListener(new View.OnTouchListener() { 
     @Override 
     public boolean onTouch(View v, MotionEvent event) { 
      v.requestFocusFromTouch(); 
      return false; 
     } 
    }); 
7

: sorun oldu

 android:focusable="true" 
     android:focusableInTouchMode="true"> 

;)

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:focusable="true" 
      android:focusableInTouchMode="true">