仿iPhone assistivetouch小工具实现详解0

大家都知道iPhone下的assistivetouch这个小圆点


对,就是这个玩意儿

但是Android上没这玩意儿,所有今天我们就给Android上弄上一个这个玩意儿


看见没,和iPhone下的基本一样吧

我准备分几次讲这个项目的开发实例写出来,照例,今天搞定界面:

1、控制球界面

2、菜单界面

这些都不难,大家看下就懂了

控制球界面:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:orientation="vertical" >

    <Button
        android:id="@+id/touch_ball"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:background="@drawable/selector_btn_assistive" />

</FrameLayout>

菜单界面:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/lay_main"
    android:layout_width="300dp"
    android:layout_height="300dp"
    android:background="@drawable/shape_background_assistivetouch"
    android:padding="4.0px" >

    <TextView
        android:id="@+id/tv_apps"
        style="@style/Icon"
        android:layout_centerInParent="true"
        android:drawableTop="@drawable/selector_ic_apps"
        android:text="apps" />

    <TextView
        android:id="@+id/tv_home_screen"
        style="@style/Icon"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:drawableTop="@drawable/selector_ic_home"
        android:text="home_screen" />

    <TextView
        android:id="@+id/tv_setting"
        style="@style/Icon"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:drawableTop="@drawable/selector_ic_phone"
        android:text="setting" />

    <TextView
        android:id="@+id/tv_lock_screen"
        style="@style/Icon"
        android:layout_centerHorizontal="true"
        android:drawableTop="@drawable/selector_ic_power_down"
        android:text="lock_screen" />

    <TextView
        android:id="@+id/tv_favor"
        style="@style/Icon"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:drawableTop="@drawable/selector_ic_star"
        android:text="favor" />

</RelativeLayout>

图片的背景大多采用Selector选择器,用来实现点击效果

ok,今天的任务比较简单,界面搞定。

明天的预定:

1、实现控制球的点击拖动

2、点击控制球后弹出菜单选择界面

3、菜单选择功能


ps:需要源码的朋友请留言,tks

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 17
    评论
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值