Android For Freshers
Android Rating Bar Source code
Java Code(RatingAct )
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RatingBar;
import android.widget.TextView;
public class RatingAct extends Activity {
TextView tv;
RatingBar rb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating);
tv = (TextView)findViewById(R.id.textView);
rb = (RatingBar)findViewById(R.id.rb1);
rb.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener()
{
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser)
{
tv.setText(“”+rating);
}
});
}
}
Layout XML Code(activity_rating))
<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:tools=”http://schemas.android.com/tools”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:orientation=”vertical”
android:paddingBottom=”@dimen/activity_vertical_margin”
android:paddingLeft=”@dimen/activity_horizontal_margin”
android:paddingRight=”@dimen/activity_horizontal_margin”
android:paddingTop=”@dimen/activity_vertical_margin”
tools:context=”com.andro.tech.androidproject.RatingAct”>
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textSize=”@dimen/textsize”
android:layout_gravity=”center”
android:textStyle=”bold”
android:text=”@string/ratingtext”
android:layout_marginBottom=”120dp” />
<RatingBar
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:id=”@+id/rb1″
android:layout_gravity=”center”
android:layout_alignParentTop=”true”
android:layout_centerHorizontal=”true” />
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:textAppearance=”?android:attr/textAppearanceLarge”
android:text=” “
android:layout_gravity=”center”
android:id=”@+id/textView”
android:layout_below=”@+id/rb1″
android:layout_centerHorizontal=”true”
android:layout_marginTop=”25dp”
android:layout_marginBottom=”120dp”/>
<Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/sourcecode”
android:background=”@color/bgcolor”
android:textStyle=”bold”
android:textColor=”@color/text”
android:onClick=”view1″/>
</LinearLayout>
Output
Android Rating Bar snippet java code download
Download Raring Bar Source code
For More Android Programs –Click Here
Follow Us – Never Miss Update
Fb/Page, Twitter, Google+, Instagram, Pinterest
Related Search
Android Rating Bar snippet java code download, Android Rating Bar java code example download, andoird rating bar snippet download, andorid rating bar code for freshers, java code of rating bar in android, rating bar example in android, rating bar java snippet code download, rating bar java snippet android source code download, rating bar source of android, rating bar simple snippet download, Android Rating Bar snippet java code download