Example usage for android.widget ScrollView ScrollView

List of usage examples for android.widget ScrollView ScrollView

Introduction

In this page you can find the example usage for android.widget ScrollView ScrollView.

Prototype

public ScrollView(Context context) 

Source Link

Usage

From source file:org.odk.collect.android.fragments.dialogs.RankingWidgetDialog.java

private ScrollView setUpRankingLayout(List<String> values, FormIndex formIndex) {
    LinearLayout rankingLayout = new LinearLayout(getContext());
    rankingLayout.setOrientation(LinearLayout.HORIZONTAL);
    rankingLayout.addView(setUpPositionsLayout(values));
    rankingLayout.addView(setUpRecyclerView(values, formIndex));
    rankingLayout.setPadding(10, 0, 10, 0);

    ScrollView scrollView = new ScrollView(getContext());
    scrollView.addView(rankingLayout);/*from   www  .  j ava2  s . c o m*/
    return scrollView;
}

From source file:de.gebatzens.ggvertretungsplan.fragment.MensaFragment.java

@Override
public void createView(LayoutInflater inflater, ViewGroup view) {
    Display display = ((WindowManager) getActivity().getApplicationContext()
            .getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    int rotation = display.getRotation();
    Log.d("Screen orientation", String.valueOf(rotation));
    if ((rotation == 3) || (rotation == 1)) {
        screen_orientation_horizotal = true;
    } else {/*from   ww w. j a  va  2s  . c  o m*/
        screen_orientation_horizotal = false;
    }
    final ScrollView sv = new ScrollView(getActivity());
    sv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    sv.setTag("mensa_scroll");
    ((LinearLayout) view.findViewById(R.id.mensa_content)).addView(sv);
    final LinearLayout l = new LinearLayout(getActivity());
    l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    l.setOrientation(LinearLayout.VERTICAL);
    int p = toPixels(6);
    l.setPadding(p, p, p, p);
    sv.addView(l);
    for (Mensa.MensaItem item : GGApp.GG_APP.mensa) {
        if (!item.isPast())
            l.addView(createCardItem(item, inflater));

    }
}

From source file:com.loloof64.android.capturing_audio.MainActivity.java

public void recordingButtonClicked(View view) {
    try {//ww  w. j av a 2  s .c  om
        recorderFragment.toggleRecordingState();
    } catch (IOException e) {
        Log.e("RecordingAudio", e.getMessage(), e);
        ///////////////////////////////////////////////////////////////////////
        AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
        dialogBuilder.setTitle("Error");

        ScrollView scrollingView = new ScrollView(dialogBuilder.getContext());
        scrollingView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        EditText textView = new EditText(dialogBuilder.getContext());
        textView.setLayoutParams(new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        textView.setText(Arrays.toString(e.getStackTrace()));

        scrollingView.addView(textView);
        dialogBuilder.setView(scrollingView);

        dialogBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            }
        });
        dialogBuilder.show();
        ////////////////////////////////////////////////////////////////////////
        Toast.makeText(this, R.string.could_not_create_temporary_file, Toast.LENGTH_SHORT).show();
    }
}

From source file:net.gsantner.opoc.util.ActivityUtils.java

public void showDialogWithHtmlTextView(@StringRes int resTitleId, String text, boolean isHtml,
        DialogInterface.OnDismissListener dismissedListener) {
    ScrollView scroll = new ScrollView(_context);
    AppCompatTextView textView = new AppCompatTextView(_context);
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16,
            _context.getResources().getDisplayMetrics());

    scroll.setPadding(padding, 0, padding, 0);
    scroll.addView(textView);//from w  w  w .ja  v  a 2s  .c  om
    textView.setMovementMethod(new LinkMovementMethod());
    textView.setText(isHtml ? new SpannableString(Html.fromHtml(text)) : text);

    AlertDialog.Builder dialog = new AlertDialog.Builder(_context).setPositiveButton(android.R.string.ok, null)
            .setOnDismissListener(dismissedListener).setTitle(resTitleId).setView(scroll);
    dialog.show();
}

From source file:org.telegram.ui.ContactAddActivity.java

@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    if (addContact) {
        actionBar.setTitle(LocaleController.getString("AddContactTitle", R.string.AddContactTitle));
    } else {/*from w w w  .ja va  2  s.c  om*/
        actionBar.setTitle(LocaleController.getString("EditName", R.string.EditName));
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                if (firstNameField.getText().length() != 0) {
                    TLRPC.User user = MessagesController.getInstance().getUser(user_id);
                    user.first_name = firstNameField.getText().toString();
                    user.last_name = lastNameField.getText().toString();
                    ContactsController.getInstance().addContact(user);
                    finishFragment();
                    SharedPreferences preferences = ApplicationLoader.applicationContext
                            .getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
                    preferences.edit().putInt("spam3_" + user_id, 1).commit();
                    NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces,
                            MessagesController.UPDATE_MASK_NAME);
                }
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = new ScrollView(context);

    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    ((ScrollView) fragmentView).addView(linearLayout);
    ScrollView.LayoutParams layoutParams2 = (ScrollView.LayoutParams) linearLayout.getLayoutParams();
    layoutParams2.width = ScrollView.LayoutParams.MATCH_PARENT;
    layoutParams2.height = ScrollView.LayoutParams.WRAP_CONTENT;
    linearLayout.setLayoutParams(layoutParams2);
    linearLayout.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    FrameLayout frameLayout = new FrameLayout(context);
    linearLayout.addView(frameLayout);
    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
    layoutParams.topMargin = AndroidUtilities.dp(24);
    layoutParams.leftMargin = AndroidUtilities.dp(24);
    layoutParams.rightMargin = AndroidUtilities.dp(24);
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.WRAP_CONTENT;
    frameLayout.setLayoutParams(layoutParams);

    avatarImage = new BackupImageView(context);
    avatarImage.setRoundRadius(AndroidUtilities.dp(30));
    frameLayout.addView(avatarImage);
    FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) avatarImage.getLayoutParams();
    layoutParams3.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
    layoutParams3.width = AndroidUtilities.dp(60);
    layoutParams3.height = AndroidUtilities.dp(60);
    avatarImage.setLayoutParams(layoutParams3);

    nameTextView = new TextView(context);
    nameTextView.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
    nameTextView.setLines(1);
    nameTextView.setMaxLines(1);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
    nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    frameLayout.addView(nameTextView);
    layoutParams3 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
    layoutParams3.width = LayoutHelper.WRAP_CONTENT;
    layoutParams3.height = LayoutHelper.WRAP_CONTENT;
    layoutParams3.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 80);
    layoutParams3.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 80 : 0);
    layoutParams3.topMargin = AndroidUtilities.dp(3);
    layoutParams3.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
    nameTextView.setLayoutParams(layoutParams3);

    onlineTextView = new TextView(context);
    onlineTextView.setTextColor(0xff999999);
    onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    onlineTextView.setLines(1);
    onlineTextView.setMaxLines(1);
    onlineTextView.setSingleLine(true);
    onlineTextView.setEllipsize(TextUtils.TruncateAt.END);
    onlineTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
    frameLayout.addView(onlineTextView);
    layoutParams3 = (FrameLayout.LayoutParams) onlineTextView.getLayoutParams();
    layoutParams3.width = LayoutHelper.WRAP_CONTENT;
    layoutParams3.height = LayoutHelper.WRAP_CONTENT;
    layoutParams3.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 80);
    layoutParams3.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 80 : 0);
    layoutParams3.topMargin = AndroidUtilities.dp(32);
    layoutParams3.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP;
    onlineTextView.setLayoutParams(layoutParams3);

    firstNameField = new EditText(context);
    firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    //firstNameField.setHintTextColor(0xff979797);
    firstNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    firstNameField.setMaxLines(1);
    firstNameField.setLines(1);
    firstNameField.setSingleLine(true);
    firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    firstNameField.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName));
    AndroidUtilities.clearCursorDrawable(firstNameField);
    linearLayout.addView(firstNameField);
    layoutParams = (LinearLayout.LayoutParams) firstNameField.getLayoutParams();
    layoutParams.topMargin = AndroidUtilities.dp(24);
    layoutParams.height = AndroidUtilities.dp(36);
    layoutParams.leftMargin = AndroidUtilities.dp(24);
    layoutParams.rightMargin = AndroidUtilities.dp(24);
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    firstNameField.setLayoutParams(layoutParams);
    firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_NEXT) {
                lastNameField.requestFocus();
                lastNameField.setSelection(lastNameField.length());
                return true;
            }
            return false;
        }
    });

    lastNameField = new EditText(context);
    lastNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    //lastNameField.setHintTextColor(0xff979797);
    lastNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    lastNameField.setMaxLines(1);
    lastNameField.setLines(1);
    lastNameField.setSingleLine(true);
    lastNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    lastNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    lastNameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
    lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName));
    AndroidUtilities.clearCursorDrawable(lastNameField);
    linearLayout.addView(lastNameField);
    layoutParams = (LinearLayout.LayoutParams) lastNameField.getLayoutParams();
    layoutParams.topMargin = AndroidUtilities.dp(16);
    layoutParams.height = AndroidUtilities.dp(36);
    layoutParams.leftMargin = AndroidUtilities.dp(24);
    layoutParams.rightMargin = AndroidUtilities.dp(24);
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    lastNameField.setLayoutParams(layoutParams);
    lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_DONE) {
                doneButton.performClick();
                return true;
            }
            return false;
        }
    });

    TLRPC.User user = MessagesController.getInstance().getUser(user_id);
    if (user != null) {
        if (user.phone == null) {
            if (phone != null) {
                user.phone = PhoneFormat.stripExceptNumbers(phone);
            }
        }
        firstNameField.setText(user.first_name);
        firstNameField.setSelection(firstNameField.length());
        lastNameField.setText(user.last_name);
    }

    return fragmentView;
}

From source file:org.lol.reddit.activities.PostSubmitActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit);

    typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type);
    usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username);
    subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit);
    titleEdit = (EditText) layout.findViewById(R.id.post_submit_title);
    textEdit = (EditText) layout.findViewById(R.id.post_submit_body);

    final Intent intent = getIntent();
    if (intent != null) {

        if (intent.hasExtra("subreddit")) {

            final String subreddit = intent.getStringExtra("subreddit");

            if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?")
                    && subreddit.matches("/?(r/)?\\w+/?")) {
                subredditEdit.setText(subreddit);
            }/* w w  w  .java 2s.  c  o m*/

        } else if (Intent.ACTION_SEND.equalsIgnoreCase(intent.getAction())
                && intent.hasExtra(Intent.EXTRA_TEXT)) {
            final String url = intent.getStringExtra(Intent.EXTRA_TEXT);
            textEdit.setText(url);
        }

    } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) {
        titleEdit.setText(savedInstanceState.getString("post_title"));
        textEdit.setText(savedInstanceState.getString("post_body"));
        subredditEdit.setText(savedInstanceState.getString("subreddit"));
        typeSpinner.setSelection(savedInstanceState.getInt("post_type"));
    }

    final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts();
    final ArrayList<String> usernames = new ArrayList<String>();

    for (RedditAccount account : accounts) {
        if (!account.isAnonymous()) {
            usernames.add(account.username);
        }
    }

    if (usernames.size() == 0) {
        General.quickToast(this, R.string.error_toast_notloggedin);
        finish();
    }

    usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames));
    typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes));

    // TODO remove the duplicate code here
    setHint();

    typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setHint();
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    setContentView(sv);
}

From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java

public AlertDialog.Builder buildNoticeDialog(CharSequence text) {
    TextView textView = new TextView(activity);
    textView.setAutoLinkMask(Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES);
    textView.setPadding((int) spaceSuperRelax, (int) spaceSuperRelax, (int) spaceSuperRelax,
            (int) spaceSuperRelax);
    textView.setText(text);//from  w  w w . j  a va  2s .c o  m
    ScrollView scrollView = new ScrollView(activity);
    scrollView.addView(textView);
    return new AlertDialog.Builder(activity).setView(scrollView).setPositiveButton(android.R.string.ok, null);
}

From source file:org.quantumbadger.redreader.activities.PostSubmitActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    final LinearLayout layout = (LinearLayout) getLayoutInflater().inflate(R.layout.post_submit);

    typeSpinner = (Spinner) layout.findViewById(R.id.post_submit_type);
    usernameSpinner = (Spinner) layout.findViewById(R.id.post_submit_username);
    subredditEdit = (EditText) layout.findViewById(R.id.post_submit_subreddit);
    titleEdit = (EditText) layout.findViewById(R.id.post_submit_title);
    textEdit = (EditText) layout.findViewById(R.id.post_submit_body);

    final Intent intent = getIntent();
    if (intent != null) {

        if (intent.hasExtra("subreddit")) {

            final String subreddit = intent.getStringExtra("subreddit");

            if (subreddit != null && subreddit.length() > 0 && !subreddit.matches("/?(r/)?all/?")
                    && subreddit.matches("/?(r/)?\\w+/?")) {
                subredditEdit.setText(subreddit);
            }//from w  w  w.  j  av a2s.co m

        } else if (intent.getAction().equalsIgnoreCase(Intent.ACTION_SEND)
                && intent.hasExtra(Intent.EXTRA_TEXT)) {
            final String url = intent.getStringExtra(Intent.EXTRA_TEXT);
            textEdit.setText(url);
        }

    } else if (savedInstanceState != null && savedInstanceState.containsKey("post_title")) {
        titleEdit.setText(savedInstanceState.getString("post_title"));
        textEdit.setText(savedInstanceState.getString("post_body"));
        subredditEdit.setText(savedInstanceState.getString("subreddit"));
        typeSpinner.setSelection(savedInstanceState.getInt("post_type"));
    }

    final ArrayList<RedditAccount> accounts = RedditAccountManager.getInstance(this).getAccounts();
    final ArrayList<String> usernames = new ArrayList<String>();

    for (RedditAccount account : accounts) {
        if (!account.isAnonymous()) {
            usernames.add(account.username);
        }
    }

    if (usernames.size() == 0) {
        General.quickToast(this, R.string.error_toast_notloggedin);
        finish();
    }

    usernameSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, usernames));
    typeSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, postTypes));

    // TODO remove the duplicate code here
    setHint();

    typeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setHint();
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    });

    final ScrollView sv = new ScrollView(this);
    sv.addView(layout);
    setContentView(sv);
}

From source file:org.telegram.ui.ChangePhoneActivity.java

@Override
public View createView(Context context) {
    actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override//from w  ww .  j  a va2 s.  co m
        public void onItemClick(int id) {
            if (id == done_button) {
                views[currentViewNum].onNextPressed();
            } else if (id == -1) {
                finishFragment();
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    fragmentView = new ScrollView(context);
    ScrollView scrollView = (ScrollView) fragmentView;
    scrollView.setFillViewport(true);

    FrameLayout frameLayout = new FrameLayout(context);
    scrollView.addView(frameLayout, LayoutHelper.createScroll(LayoutHelper.MATCH_PARENT,
            LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT));

    views[0] = new PhoneView(context);
    views[1] = new LoginActivitySmsView(context, 1);
    views[2] = new LoginActivitySmsView(context, 2);
    views[3] = new LoginActivitySmsView(context, 3);
    views[4] = new LoginActivitySmsView(context, 4);

    for (int a = 0; a < views.length; a++) {
        views[a].setVisibility(a == 0 ? View.VISIBLE : View.GONE);
        frameLayout.addView(views[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT,
                a == 0 ? LayoutHelper.WRAP_CONTENT : LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT,
                AndroidUtilities.isTablet() ? 26 : 18, 30, AndroidUtilities.isTablet() ? 26 : 18, 0));
        //LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 16, 30, 16, 0)
    }

    actionBar.setTitle(views[0].getHeaderName());

    return fragmentView;
}

From source file:br.org.funcate.dynamicforms.views.GSketchView.java

/**
 * @param noteId                the id of the note this image belows to.
 * @param fragmentDetail        the fragment detail  to use.
 * @param attrs                 attributes.
 * @param requestCode           the code for starting the activity with result.
 * @param parentView            parent/*from  w  ww  .j a v  a  2s. c  om*/
 * @param label                 label
 * @param value                 value
 * @param constraintDescription constraints
 */
public GSketchView(final long noteId, final FragmentDetail fragmentDetail, AttributeSet attrs,
        final int requestCode, LinearLayout parentView, String label, String value,
        String constraintDescription) {
    super(fragmentDetail.getActivity(), attrs);
    this.noteId = noteId;

    _value = value;

    final FragmentActivity activity = fragmentDetail.getActivity();
    LinearLayout textLayout = new LinearLayout(activity);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 10, 10, 10);
    textLayout.setLayoutParams(layoutParams);
    textLayout.setOrientation(LinearLayout.VERTICAL);
    parentView.addView(textLayout);

    TextView textView = new TextView(activity);
    textView.setLayoutParams(
            new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    textView.setPadding(2, 2, 2, 2);
    textView.setText(label.replace(UNDERSCORE, " ").replace(COLON, " ") + " " + constraintDescription);
    textView.setTextColor(activity.getResources().getColor(R.color.formcolor));
    textLayout.addView(textView);

    final Button button = new Button(activity);
    button.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    button.setPadding(15, 5, 15, 5);
    button.setText(R.string.draw_sketch);
    textLayout.addView(button);

    button.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            try {
                SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
                double[] gpsLocation = PositionUtilities.getGpsLocationFromPreferences(preferences);

                Date currentDate = new Date();
                String sketchImageName = ImageUtilities.getSketchImageName(currentDate);

                File tempDir = ResourcesManager.getInstance(getContext()).getTempDir();
                File sketchFile = new File(tempDir, sketchImageName);
                /*
                 * open markers for new sketch
                 */
                MarkersUtilities.launch(fragmentDetail, sketchFile, gpsLocation, requestCode);
            } catch (Exception e) {
                //GPLog.error(this, null, e);
                Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
            }
        }
    });

    ScrollView scrollView = new ScrollView(activity);
    ScrollView.LayoutParams scrollLayoutParams = new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, 150);
    scrollView.setLayoutParams(scrollLayoutParams);
    parentView.addView(scrollView);

    imageLayout = new LinearLayout(activity);
    LinearLayout.LayoutParams imageLayoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);
    imageLayout.setLayoutParams(imageLayoutParams);
    // imageLayout.setMinimumHeight(200);
    imageLayout.setOrientation(LinearLayout.HORIZONTAL);
    scrollView.addView(imageLayout);
    // scrollView.setFillViewport(true);

    try {
        refresh(activity);
    } catch (Exception e) {
        //GPLog.error(this, null, e);
        Toast.makeText(this.getContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }
}