ToggleButton,Switch,RatingBar的使用

 <ToggleButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textOff="2"
        android:textOn="1" />

    <Switch
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textOff="2"
        android:textOn="1" />

    <RatingBar
        android:id="@+id/rating_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:numStars="4"
        android:rating="1.5" />

 @Override
    public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
        if(fromUser)
            Toast.makeText(this, "等级是:" + rating, Toast.LENGTH_SHORT).show();
    }

你可能感兴趣的:(android)