0

画像と TextView を含む View を動的に作成しています。これは ViewFlipper に追加されます。問題はスクロールバーを常に表示する必要があるため、これはすべて機能していますが、スクロールバーを機能させることができず、何が間違っているのかわかりません。

以下は、複製しようとしている動的コードとxmlコードです

for(int i = 0; i < 5; i++)
{
    // Creating my linear layouts & views
    lls = new LinearLayout(this);
    llv = new LinearLayout(this);
    lls.setOrientation(LinearLayout.VERTICAL);

    // Adding image view
    imgStory = new ImageView(this);
    imgStory.setImageResource(GetImage(i));
    imgStory.setLayoutParams(new LayoutParams(width, width));
    lls.addView(imgStory);

    // adding textview, which is scrollable
    txtStory = new TextView(this);
    txtStory.setText(unescape(story.get(i)));
    txtStory.setTextColor(getResources().getColor(R.color.orange));
    txtStory.setPadding((int)padding, (int)padding, (int)padding, (int)padding);
    txtStory.setMovementMethod(new ScrollingMovementMethod());
    //txtStory.setVerticalScrollBarEnabled(true);
    //txtStory.setVerticalFadingEdgeEnabled(false);
    lls.addView(txtStory);

    // Adding views to my view flipper
    llv.addView(lls);
    viewFlipper.addView(llv, i);
}

プログラムで複製しようとしている XML コード

<TextView
    android:id="@+id/txtStoryText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/imgStoryLine"
    android:layout_above="@+id/footer"
    android:layout_margin="20dp"
    android:scrollbars="vertical"
    android:scrollbarSize="10dp"
    android:fadeScrollbars="false"
    android:textColor="@color/orange"
    android:text="" />
4

1 に答える 1