-1
layContent = (LinearLayout) findViewById(R.id.ll_survey_list);

  TextView textQuestion;

            textQuestion = new TextView(this);
            textQuestion.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
            textQuestion.setTextColor(Color.parseColor("#000000"));
            textQuestion.setPadding(8,35,3,0);
            textQuestion.setVisibility(View.VISIBLE);
            textQuestion.setText(surveyS.get(s));
            layContent.addView(textQuestion);

I have already made a textview programmatically and I want to make one programmatically for fragment google map like Textview. How can I do that ?

<fragment
           android:id="@+id/map"
           android:name="com.google.android.gms.maps.MapFragment"
           android:layout_width="match_parent"
           android:layout_height="200dp"
           android:layout_centerHorizontal="true"
           android:visibility="gone"/>

My question is this Googlemap will array in layContent

Hans1984
  • 796
  • 11
  • 24
Megi Fernanda
  • 263
  • 1
  • 4
  • 15

1 Answers1

0

FragmentManager fragmentManager = getFragmentManager (); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction (); fragmentTransaction.add (R.id.myFrame, myFrag); fragmentTransaction.commit ();

check this link: https://www.intertech.com/Blog/programmatically-working-with-android-fragments/

Mike
  • 21
  • 7