package hui.gz.satrview; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity { private Button refreshBtn; private TextView mProgressTx; private EditText mProgress; private StarView mStarView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); refreshBtn = (Button) findViewById(R.id.refreshBtn); mProgressTx = (TextView) findViewById(R.id.text); mProgress = (EditText) findViewById(R.id.editText); mStarView = (StarView) findViewById(R.id.starview); refreshBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { float progress = Float.parseFloat(mProgress.getText().toString()); mProgress.setText(""); mProgressTx.setText(mProgress.getText().toString()); mStarView.setStarViewProgress(progress); } }); } }
评论