超简单的 BlueTooth 蓝牙开发实例,打开蓝牙,关闭蓝牙,配对,解除,功能齐全
布局就不多说了,粘贴过去就能用。
<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="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:padding="5dp" >
<Button
android:id="@+id/btn_on_off"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_settings_drag_off_new" />
</RelativeLayout>
<Button
android:id="@+id/btn_visible"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="可见"
android:textSize="12sp" />
<Button
android:id="@+id/btn_find"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="查找"
android:textSize="12sp" />
<Button
android:id="@+id/btn_