[InternalSelectionScroll.java]

public class InternalSelectionScroll extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ScrollView sv = new ScrollView(this);
        ViewGroup.LayoutParams svLp = new ScrollView.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);

        LinearLayout ll = new LinearLayout(this);
        ll.setLayoutParams(svLp);
        sv.addView(ll);

        InternalSelectionView isv = new InternalSelectionView(this, 10);
        int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
        LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                2 * screenHeight);  // 2x screen height to ensure scrolling
        isv.setLayoutParams(llLp);
        ll.addView(isv);
       
        setContentView(sv);
    }
}

'old > API_Demo' 카테고리의 다른 글

Views_Layout_Table Layout_Empty Cells  (0) 2010.04.26
Views_Layout_Table Layout_Basic  (0) 2010.04.26
Views_Layout_ScrollView_Long  (0) 2010.04.26
Views_Layout_ScrollView_Short  (0) 2010.04.26
Views_Layout_Relative Layout_Simple Form  (0) 2010.04.26
Posted by jazzlife
,