Back to project page pinpoint-android.
The source code is released under:
MIT License
If you think the Android project pinpoint-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package co.islovely.pinpoint; // w w w . j a v a 2s. co m import android.app.Activity; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; public class LayoutConfigurationActivity extends Activity implements OnSeekBarChangeListener { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.layoutconfiguration); int headerHeight = Configuration.getInstance().getHeaderHeight(), footerHeight = Configuration.getInstance().getFooterHeight(); SeekBar seekBarFooter = (SeekBar) this.findViewById(R.id.seekBarFooter); seekBarFooter.setProgress(footerHeight); seekBarFooter.setOnSeekBarChangeListener(this); ((LinearLayout) this.findViewById(R.id.footer)).setLayoutParams( new LayoutParams(LayoutParams.MATCH_PARENT, footerHeight) ); SeekBar seekBarHeader = (SeekBar) this.findViewById(R.id.seekBarHeader); seekBarHeader.setProgress(headerHeight); seekBarHeader.setOnSeekBarChangeListener(this); ((LinearLayout) this.findViewById(R.id.header)).setLayoutParams( new LayoutParams(LayoutParams.MATCH_PARENT, headerHeight) ); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int targetId = 0; switch (seekBar.getId()) { case R.id.seekBarFooter: targetId = R.id.footer; break; case R.id.seekBarHeader: targetId = R.id.header; break; } // update layout with current value to see change ((LinearLayout) this.findViewById(targetId)).setLayoutParams( new LayoutParams(LayoutParams.MATCH_PARENT, progress) ); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // nothing to do } @Override public void onStopTrackingTouch(SeekBar seekBar) { Configuration configuration = Configuration.getInstance(); // update configuration with final value switch (seekBar.getId()) { case R.id.seekBarFooter: configuration.setFooterHeight(seekBar.getProgress()); break; case R.id.seekBarHeader: configuration.setHeaderHeight(seekBar.getProgress()); break; } } }