Android ScrollView滚动示图显示

当要显示一串很长的字串时可用ScrollView:

public View DisplayScrollView()
{
    ScrollView scroller = new ScrollView(getActivity());
    TextView text = new TextView(getActivity());

    int padding = (int) TypedValue.applyDimension(
		TypedValue.COMPLEX_UNIT_DIP, 4, getActivity()
		.getResources().getDisplayMetrics());
    text.setPadding(padding, padding, padding, padding);
    scroller.addView(text);
    text.setText(array[getShownIndex()]);

    return scroller;
}

你可能感兴趣的:(android)