Code example for ScrollView

Methods: addView, setId, setLayoutParams, setPadding

0
     
    addView(wrapperBase);
  } 
   
  private void loadFeedbackScrollView(Context context) {
    feedbackScrollView = new ScrollView(context);
    feedbackScrollView.setId(FEEDBACK_SCROLLVIEW_ID);
     
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 10.0, getResources().getDisplayMetrics());
    params.gravity = Gravity.CENTER;
     
    feedbackScrollView.setLayoutParams(params);
    feedbackScrollView.setPadding(padding, padding, padding, padding);
     
    wrapperBase.addView(feedbackScrollView);
  } 
   
  private void loadWrapperLayoutFeedback(Context context) {
    wrapperLayoutFeedback = new LinearLayout(context);
    wrapperLayoutFeedback.setId(WRAPPER_LAYOUT_FEEDBACK_ID);
     
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 10.0, getResources().getDisplayMetrics());
    params.gravity = Gravity.LEFT;
     
    wrapperLayoutFeedback.setLayoutParams(params);
    wrapperLayoutFeedback.setPadding(padding, padding, padding, padding);
    wrapperLayoutFeedback.setGravity(Gravity.TOP);
    wrapperLayoutFeedback.setOrientation(LinearLayout.VERTICAL);
     
    feedbackScrollView.addView(wrapperLayoutFeedback);
  } 
 
  private void loadWrapperLayoutFeedbackAndMessages(Context context) {
    wrapperLayoutFeedbackAndMessages = new LinearLayout(context);
    wrapperLayoutFeedbackAndMessages.setId(WRAPPER_LAYOUT_FEEDBACK_AND_MESSAGES_ID);