2017-02-10 3 views
0

Ich habe dieses widget:Android: Next EditText Fokus mit unterschiedlichen Ansichten nicht richtig funktioniert

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/root" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@android:color/white" 
    android:foreground="?attr/selectableItemBackground"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_vertical" 
     android:orientation="horizontal" 
     android:padding="@dimen/keyline_1"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical"> 

      <LinearLayout 
       android:id="@+id/title_layout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_centerVertical="true" 
       android:orientation="vertical"> 

       <TextView 
        android:id="@+id/title" 
        style="@style/WizardItemTitleView" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:maxLines="1" 
        android:singleLine="true"/> 

       <TextView 
        android:id="@+id/subtitle" 
        android:textColor="@color/amber_200" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:visibility="gone"/> 

      </LinearLayout> 

      <LinearLayout 
       android:id="@+id/info_layout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:layout_toRightOf="@+id/title_layout" 
       android:layout_marginLeft="@dimen/keyline_1" 
       android:gravity="right" 
       android:focusable="true" 
       android:focusableInTouchMode="true" 
       android:layout_alignParentRight="true" 
       android:layout_centerVertical="true"> 

       <EditText 
        android:id="@+id/edit" 
        style="@style/WizardItemEditTextView" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:gravity="left" 
        android:maxLines="1" 
        android:singleLine="true"/>      

      </LinearLayout> 

     </RelativeLayout> 

    </LinearLayout> 

</FrameLayout> 

Dies ist mein Test-Layout:

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

    <com.example.anthony.myapplication.wizard.ItemWizardEditTextView 
     android:id="@+id/name" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:title="NOM"/> 

    <com.example.anthony.myapplication.wizard.ItemWizardEditTextView 
     android:id="@+id/brand1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:title="MARQUE 1"/> 

    <com.example.anthony.myapplication.wizard.ItemWizardEditTextView 
     android:id="@+id/brand2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:title="MARQUE 2"/> 

    <com.example.anthony.myapplication.wizard.ItemWizardEditTextView 
     android:id="@+id/brand3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:title="MARQUE 3"/> 

</LinearLayout> 

Wenn ich also standardmäßig @ + id gesetzt/name edittext mit einem Standardwert, dann kann die nächste Aktion für meinen nächsten EditText nicht ausgeführt werden. Ich weiß nicht, wo der Fokus liegt.

Vielen Dank für Ihre Hilfe!

Antwort

0

, wenn Sie auf einem der EditText konzentrieren wollen verwenden

<requestfocus /> 

und seine gut Sichtbarkeit zu verwenden programmaticaly

Verwandte Themen