Android 在片段中编辑文本的自定义列表视图

Android 在片段中编辑文本的自定义列表视图,android,listview,android-fragments,tabs,google-cloud-firestore,Android,Listview,Android Fragments,Tabs,Google Cloud Firestore,我有一个片段选项卡,当用户单击“添加”按钮时,我需要生成一行新的EditText,其中包含用户添加的数据,并使用“保存”按钮保存此图片中的数据 制表符片段类 } 我需要在哪里添加代码 AddNewItemFragment类 }将floatingAction按钮和edittext放在框架布局中,并相应地将其重力和填充设置在要显示的位置 <FrameLayout android:layout_width="match_parent" android:l

我有一个片段选项卡,当用户单击“添加”按钮时,我需要生成一行新的EditText,其中包含用户添加的数据,并使用“保存”按钮保存此图片中的数据

制表符片段类

}

我需要在哪里添加代码

AddNewItemFragment类


}

将floatingAction按钮和edittext放在框架布局中,并相应地将其重力和填充设置在要显示的位置

    <FrameLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        <android.support.design.widget.FloatingActionButton
                android:id="@+id/floatingButtonAdd"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"   
                android:backgroundTint="@color/Green"
                android:contentDescription="@null"
                android:gravity="bottom|end"
                android:padding="3dp"
                android:src="@drawable/check" />

 <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/fab"
        android:clickable="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true">
       <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Item name"
            android:id="@+id/input" />
    </android.support.design.widget.TextInputLayout>
    </FrameLayout>

为什么向下投票?你能解释我的问题有什么不清楚的吗?你应该添加一个浮动操作按钮这段代码有什么问题?我的问题是,我需要一个自定义列表视图,编辑文本有0行,当我点击fab按钮时,你在列表视图中创建了一个新行,我可以在其中输入数据。这张图片是只有一个设计我需要我的listview像我的设计一样创建,当我点击晶圆厂一个新的编辑文本行被创建
public class AddNewItemFragment extends Fragment {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    return inflater.inflate(R.layout.new_items_swipe_activity_design,null);
}
    <FrameLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        <android.support.design.widget.FloatingActionButton
                android:id="@+id/floatingButtonAdd"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"   
                android:backgroundTint="@color/Green"
                android:contentDescription="@null"
                android:gravity="bottom|end"
                android:padding="3dp"
                android:src="@drawable/check" />

 <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@id/fab"
        android:clickable="true"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true">
       <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Item name"
            android:id="@+id/input" />
    </android.support.design.widget.TextInputLayout>
    </FrameLayout>
public class AddNewItemFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

 mView = inflater.inflate(R.layout.new_items_swipe_activity_design, false);

 fab = (FloatingActionButton) mView.findViewById(R.id.floatingButtonAdd);
        fab.bringToFront();
        input = (EditText) mView.findViewById(R.id.input);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

          //do your code
            }
        });

    return inflater.inflate(R.layout.new_items_swipe_activity_design,null);


}