添加简单位置信息保存功能
This commit is contained in:
21
positions/src/main/res/drawable/circle_button_bg.xml
Normal file
21
positions/src/main/res/drawable/circle_button_bg.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 圆形按钮背景:默认青色,按压时深色 -->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 按钮按压状态(深色,增强交互反馈) -->
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="oval"> <!-- oval=圆形 -->
|
||||
<solid android:color="#0F9D58"/> <!-- 按压时颜色:深青色(接近Google绿,美观且醒目) -->
|
||||
<stroke android:width="1dp" android:color="#0F9D58"/> <!-- 边框颜色与背景一致,避免白边 -->
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- 按钮默认状态(青色) -->
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="#14C38E"/> <!-- 默认颜色:亮青色(视觉舒适,符合悬浮按钮风格) -->
|
||||
<stroke android:width="1dp" android:color="#14C38E"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@@ -1,34 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<!-- 根布局改为RelativeLayout,支持悬浮按钮绝对定位(右下角) -->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
<!-- 原有内容:经纬度显示区域(保持居中) -->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="实时位置信息"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"/>
|
||||
android:layout_centerInParent="true"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<!-- 经度显示(大字体,清晰可见) -->
|
||||
<TextView
|
||||
android:id="@+id/tv_longitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前经度:等待更新..."
|
||||
android:textSize="18sp"/>
|
||||
<!-- 标题 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="实时位置信息"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
<!-- 纬度显示(大字体,清晰可见) -->
|
||||
<TextView
|
||||
android:id="@+id/tv_latitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前纬度:等待更新..."
|
||||
android:textSize="18sp"/>
|
||||
<!-- 经度显示 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_longitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前经度:等待更新..."
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
<!-- 纬度显示 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_latitude"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="当前纬度:等待更新..."
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 新增:右下角圆形悬浮按钮(中间显示大写P字母) -->
|
||||
<Button
|
||||
android:id="@+id/fab_p_button"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_margin="20dp"
|
||||
android:background="@drawable/circle_button_bg"
|
||||
android:text="P"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="24sp"
|
||||
android:elevation="6dp"
|
||||
android:padding="0dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user