.当我们打开蓝牙时搜索附近的蓝牙,步骤如下
1.添加权限:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
2.加入代码
//主布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:textSize="25dp"
android:text="服务态度"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center_vertical"
android:numStars="5"
android:rating="0" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="描述相符"/>
<com.example.ratingbar.RatingBar
android:id="@+id/ratingbar2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:starCount="5"
app:starEmpty="@drawable/star_20x20_n"
app:starFill="@drawable/star_20x20_hl"
app:starHalf="@drawable/star_20x20_h"
app:starImageSize="30dp"
app:starPadding="10dp"
app:starStep="0.0"
android:layout_marginLeft="3dp"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/teview_evaluate"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:textColor="#F71515"
android:textSize="19dp" />
</LinearLayout>
<EditText
android:layout_width="match_parent"
a