Code example for ScrollView

Methods: addViewsetFillViewport, setHorizontalScrollBarEnabled, setVerticalScrollBarEnabled

0
    private void showAboutDialog () { 
        aboutApp = new LinearLayout(this);
        aboutApp.setOrientation(LinearLayout.VERTICAL);
        aboutApp.setPadding(5, 3, 3, 3);
        aboutApp.setGravity(Gravity.CENTER);
        ScrollView descScrollArea = new ScrollView(this);
        descScrollArea.setFillViewport(false);
        descScrollArea.setHorizontalScrollBarEnabled(false);
        descScrollArea.setVerticalScrollBarEnabled(true);
            LinearLayout linearArea = new LinearLayout(this);
            linearArea.setLayoutParams(
                        new LinearLayout.LayoutParams(
                                        LinearLayout.LayoutParams.FILL_PARENT,
                                        LinearLayout.LayoutParams.WRAP_CONTENT));
            linearArea.setOrientation(LinearLayout.VERTICAL);
            linearArea.setVerticalGravity(Gravity.CENTER_HORIZONTAL);
                ImageButton logo = new ImageButton(this); logo.setImageResource(R.drawable.about);
                logo.setBackgroundColor(Color.TRANSPARENT);
                TextView logoLabel = new TextView(this);
                logoLabel.setTextColor(Color.WHITE);
                logoLabel.setTextSize(14);
                logoLabel.setGravity(Gravity.CENTER);
                logoLabel.setText("Bapas Mobile Prototype");
                TextView subLogoLabel = new TextView(this);
                subLogoLabel.setTextColor(Color.argb(255, 148, 169, 244));
                subLogoLabel.setTextSize(14);
                subLogoLabel.setTypeface(Typeface.DEFAULT_BOLD);
                subLogoLabel.setGravity(Gravity.CENTER);
                subLogoLabel.setText("Copyright (c) 2011\nJavan IT Services\nwww.javan.co.id");
                subLogoLabel.setOnClickListener(new OnClickListener() {
                    public void onClick(View arg0) {
                        try { 
                            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.javan.co.id"));
                            startActivity(intent);
                        } catch (Exception ex) {
                            ex.printStackTrace();
                        } 
                    } 
                }); 
            linearArea.addView(logo);
            linearArea.addView(logoLabel);
            linearArea.addView(subLogoLabel);
        descScrollArea.addView(linearArea);
        aboutApp.addView(descScrollArea);
        // Show Up ... 
        removeDialog(ABOUT_DIALOG_ID);
        showDialog(ABOUT_DIALOG_ID);
    }