<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <corners android:radius="15dp" /> <solid android:color="#337AB7"/> </shape> </item> </selector>
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.razormist.simpleratingbar.MainActivity"> <RatingBar android:id="@+id/rb_rate" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="192dp" android:isIndicator="false" android:numStars="5" android:rating="0" android:stepSize="1" /> <TextView android:id="@+id/tv_result" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="42dp" android:layout_alignParentTop="true" android:textSize="40sp" android:layout_centerHorizontal="true" /> android:id="@+id/btn_submit" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@id/rb_rate" android:layout_centerInParent="true" android:layout_marginTop="50dp" android:text="Submit" android:background="@drawable/button_style" android:textColor="#fff"/> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.razormist.simpleratingbar"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:configChanges="orientation" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
private TextView tv_result; private RatingBar rb_rate;
void InitializeVariables(){ rb_rate = (RatingBar)findViewById(R.id.rb_rate); tv_result = (TextView)findViewById(R.id.tv_result); } void RatingUpdate(){ rb_rate.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() { @Override public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { } }); } void SubmitRating(){ @Override Toast.makeText(MainActivity.this, "Thanks for the rate", Toast.LENGTH_SHORT).show(); } }); }
InitializeVariables(); RatingUpdate(); SubmitRating();
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.