I am trying to add textView to frameLayout . textView has textView properties, so it grows when text grows. I add it to frameLayout using this function:
((FrameLayout) findViewById(R.id.mainLayout)).addView(mEditText);
This is the xml of the frame layout:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainLayout" android:layout_width="wrap_content" android:layout_height="wrap_content"> </FrameLayout>
TextView always appears in the upper left corner of the screen. I would like to place it in the middle or in the middle. How can I do that?
I looked through the answers in How can I dynamically set the position of a view in Android? , and they didn’t help much :( Mostly caused by crashes ..
n00b programmer
source share