Skip to content

We can handle lots of forms in a single Activity using Dynamic forms like : TextView, EditText , Spinner etc. Normally we add field from XML layout but we can also add these programatically. This repository have a sample project which have some sample dynnamic forms.

Notifications You must be signed in to change notification settings

aliahmedbd/Android-Dynamic-Form-Fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Android-Dynamic-Form-Fields-

We can handle lots of forms in a single Activity using Dynamic forms like : TextView, EditText , Spinner etc. Normally we add view(fields) from XML layout but we can also add these programatically. This repository have a sample project which contains some sample dynnamic forms and views.

Sample Dynamic form:

public static EditText setEditText(LinearLayout formLayout, Context context, String hint) {
        EditText myEditText = new EditText(context);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT);
        myEditText.setLayoutParams(layoutParams);
        myEditText.setHint(hint);
        layoutParams.setMargins(0, dpToPx(16), 0, 0);
        myEditText.setTextSize(14);
        myEditText.getBackground().setColorFilter(context.getResources().getColor(R.color.fourth_black), PorterDuff.Mode.SRC_ATOP);
        formLayout.addView(myEditText);
        return myEditText;
    }

This way we can add Dynamic Forms in an Activity without XML.

About

We can handle lots of forms in a single Activity using Dynamic forms like : TextView, EditText , Spinner etc. Normally we add field from XML layout but we can also add these programatically. This repository have a sample project which have some sample dynnamic forms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages