scrollview(android studio)存在问题

scrollview(android studio)存在问题,android,android-layout,android-fragments,android-xml,android-scrollview,Android,Android Layout,Android Fragments,Android Xml,Android Scrollview,我的问题是,我复制了布局的内容,我不明白原因。 我正在处理片段,代码如下 片段代码 <?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_pare

我的问题是,我复制了布局的内容,我不明白原因。 我正在处理片段,代码如下

片段代码

<?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>

java片段

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;
    }
}
public类CrearItinerarioFragment扩展了Fragment{
专用按钮连续;
私人编辑文本pob,nomb;
私有int flag1=0,flag2=0;
@凌驾
CreateView上的公共视图(布局、充气机、视图组容器、捆绑包保存状态){
视图=充气机。充气(R.layout.fragment\u crear\u巡回,容器,假);
pob=(EditText)view.findViewById(R.id.Poblacion);
nomb=(EditText)view.findViewById(R.id.Nombre);
continuar=(按钮)view.findViewById(R.id.BotonContinuar);
addTextChangedListener(新的文本验证程序(pob){
@凌驾
公共无效验证(EditText EditText、字符串文本){
//瓦乔坎普酒店

如果(text.length()要在布局中动态添加数据,则需要删除所有视图并再次添加它们


您能否在Fragment类中显示您在FragmLayout中添加视图的代码?添加片段代码Fragment的Java代码发布创建CrearItinerarioFragment的活动的代码。
<?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>