0

내 문제는 레이아웃의 내용을 복제하고 이유를 이해하지 못하는 것입니다. 내가 단편 작업있어 다음과 같은 코드가scrollview (android-studio) 관련 문제

단편 코드

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/activity_crear_itinerario" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <fragment 
     android:name="com.example.pablo.p_final2.CrearItinerarioFragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

</FrameLayout> 

자바 단편

public class CrearItinerarioFragment extends Fragment{ 

    private Button continuar; 
    private EditText pob, nomb; 
    private int flag1 = 0,flag2 = 0; 

    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
     View view = inflater.inflate(R.layout.fragment_crear_itinerario, container, false); 


     pob = (EditText) view.findViewById(R.id.Poblacion); 
     nomb = (EditText) view.findViewById(R.id.Nombre); 

     continuar = (Button) view.findViewById(R.id.BotonContinuar); 

     pob.addTextChangedListener(new TextValidator(pob) { 
      @Override 
      public void validate(EditText editText, String text) { 
       //Implementamos la validación De campo vacio 
       if(text.length() <= 0 ) { 
        pob.setError(getString(R.string.CampoVacio)); 
        flag1 = 0; 
       } 
       else 
       { 
        flag1 = 1; 
       } 
      } 
     }); 

     nomb.addTextChangedListener(new TextValidator(nomb) { 
      @Override 
      public void validate(EditText editText, String text) { 
       //Implementamos la validación de campo vacio 
       if(text.length() <= 0 ) { 
        nomb.setError(getString(R.string.CampoVacio)); 
        flag2 = 0; 
       }else 
       { 
        flag2 = 1; 
       } 
      } 
     }); 

     continuar.setOnClickListener(new View.OnClickListener() { 

      @Override 
      public void onClick(View v) { 

       if(flag1!=1 || flag2 !=1) 
       { 
        Toast.makeText(CrearItinerarioFragment.this.getActivity(), getString(R.string.CamposVacios),Toast.LENGTH_LONG).show(); 
       } 
       else 
       { 
        Toast.makeText(CrearItinerarioFragment.this.getActivity(), getString(R.string.ItinerarioCreado), Toast.LENGTH_LONG).show(); 
        //Creamos el intent 
        Intent intent = new Intent(CrearItinerarioFragment.this.getActivity(), ControlarItinerarioActivity.class); 

        //Iniciamos la nueva actividad 
        startActivity(intent); 
       } 

      } 
     }); 

    return view; 
    } 
} 

있는 ScrollView

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/fragment_hacer_foto"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <TextView 
      android:id="@+id/LblTitulo" 
      android:text="@string/TituloFoto" 
      android:layout_margin="15dp" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textSize="30dp" 
      android:gravity="center"/> 

     <EditText 
      android:id="@+id/Titulo" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="15dp" 
      android:maxLength="30" /> 

     <TextView 
      android:id="@+id/LblComentario" 
      android:text="@string/ComentarioFoto" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textSize="30dp" 
      android:gravity="center" 
      android:layout_margin="15dp"/> 

     <EditText 
      android:id="@+id/Comentario" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="15dp" 
      android:maxLength="400"/> 

     <Button 
      android:id="@+id/BtnContinuar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="15dp" 
      android:text="@string/continuar"/> 

    </LinearLayout> 
</ScrollView> 

[1]! http://en.zimagez.com/zimage/photo1278635382500599725.php " 올바른 "

,363,210

[2] :! http://en.zimagez.com/zimage/photo1278635382500599724.php "문제"

나는 그것이 첫 번째 사진에서와 동일하게 유지하기를 원하지만를 최대한 빨리이 글고 중 하나를 클릭하거나 화면이 두 번째

로 설정되어 이동 동적 레이아웃에 데이터를 추가하는 경우

는 당신은 당신이 추가 위치를 조각 클래스에서 무엇을하고 있는지 코드를 보여 주시겠습니까 모든보기를 제거하고 다시

을 추가해야합니다, 당신에게

+0

조각 코드 –

+0

조각 용 Java 코드 –

+0

CrearItinerarioFragment를 작성중인 활동 코드를 게시하십시오. – Kiya

답변

0

대단히 감사합니다 조회수 : framlayout