Code example for ScrollView

Methods: addView, setLayoutParams, setPadding

0
     */ 
    private ScrollView createActionsView() {
	LayoutParams fillParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
	int padding = this.getResources().getDimensionPixelSize(R.dimen.padding);
 
	ScrollView sv = new ScrollView(PluginActivity.this);
	sv.setLayoutParams(fillParams);
	sv.setPadding(padding, padding, padding, padding);
 
	ExpandableListView elv = new ExpandableListView(PluginActivity.this) {
	    // workaround to get a ExpandableListView displayed in a ScrollView 
	    @Override 
	    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		// Calculate entire height by providing a very large height hint. 
		// But do not use the highest 2 bits of this integer; those are 
		// reserved for the MeasureSpec mode. 
		int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
		super.onMeasure(widthMeasureSpec, expandSpec);
 
		android.view.ViewGroup.LayoutParams params = getLayoutParams();
		params.height = getMeasuredHeight();
	    } 
	}; 
 
	elv.setLayoutParams(fillParams);
	SimpleExpandableListAdapter sela = new PluginActionsExpandableListAdapter(this, PluginActivity.this,
		createGroupList(), R.layout.group_row, new String[] { NAME }, new int[] { R.id.row_name },
		createChildList(), R.layout.child_row, new String[] { DESC }, new int[] { R.id.grp_child });
	elv.setAdapter(sela);
	sv.addView(elv);
	return sv;
    } 
 
    /** 
     * Creates the View containing the Plugin description. 
Connect your IDE to all the code out there  Get Codota for Java