Android下的扩展SeekBar
2010-05-28 15:36:00 来源:WEB开发网{
super(aoContext, attrs);
this.coContext = aoContext;
}
public int getMin()
{
return ciMinVal;
}
public void setMin(int aiMin)
{
ciMinVal = aiMin;
}
public void setMax(int aiMax)
{
ciMaxVal = aiMax;
}
public void setUnit(String asUnit)
{
csUnit = asUnit;
}
public void setKeyProgressIncrement(int aiIncrement)
{
ciIncrement = aiIncrement;
}
public void setValue(int aiVal)
{
ciInitVal = aiVal;
}
protected void onPrepareDialogBuilder(Builder builder)
{
LayoutInflater factory = LayoutInflater.from(coContext);
View loSeekBarView = factory.inflate(R.layout.view_ext_seekbar, null);
builder.setView(loSeekBarView);
coSeekBar = (SeekBar)loSeekBarView.findViewById(R.id.SeekBarControl);
coSeekBar.setOnSeekBarChangeListener(this);
coSeekBar.setMax(ciMaxVal-ciMinVal);
coSeekBar.setKeyProgressIncrement(ciIncrement);
TextView loMinText = (TextView)loSeekBarView.findViewById(R.id.SeekBarMin);
loMinText.setText(ciMinVal+csUnit);
TextView loMaxText = (TextView)loSeekBarView.findViewById(R.id.SeekBarMax);
loMaxText.setText(ciMaxVal+csUnit);
coSeekBarValView = (TextView)loSeekBarView.findViewById(R.id.SeekBarVal);
//initial value
coSeekBar.setProgress(ciInitVal-ciMinVal);
}
public void setSummary(int aiVal)
{
String lsSummary="";
lsSummary = (aiVal) + csUnit;
super.setSummary(lsSummary);
}
protected void onDialogClosed(boolean positiveResult)
{
if (positiveResult)
更多精彩
赞助商链接