I have implemented Dynamic TextViews. I am able to view my dynamically generated textview. however, I need to implement a scrollview:
1.Using Code only.
Kindly help.
How do i achieve these 2 functionality? The code below works just fine(it gets all the textview and displays in the screen dynamically but without the scrolling functionality)
TextView[] textViewArray = new TextView[iterator]; for( int i = 0; i < iterator; i++) { textViewArray[i] = new TextView(narutoLinksOnly.this); textViewArray[i].setText(narutoLinkHeadingName[i]); textViewArray[i].setId(i); textViewArray[i].setTextColor(0xff000000); textViewArray[i].setTextSize(20); textViewArray[i].setOnClickListener(this); textViewArray[i].setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));//suggested //textViewArray[i].setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); ((LinearLayout) linearLayout).addView(textViewArray[i]); } InSide Oncreate:
linearLayout = findViewById(R.id.dynamicTextview1); XML Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dynamicTextview1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/Ivory" android:orientation="vertical" > </LinearLayout>