在SeekArc视图的预留中,按下按钮时不会被点击

时间:2014-10-08 09:29:07

标签: android xml android-layout android-view

我正在构建一个应用程序,其中布局包含一个按钮,在该按钮下方有一个seekarc视图 (使用来自https://github.com/TriggerTrap/SeekArc的github项目的代码。)

该应用程序在测试手机上成功运行,但是当我尝试单击该按钮时,它没有单击它,只是调整了seekarc上的proge,即使我根本没有触及seekarc 。就好像寻找弧线完全集中在一起,让按钮散开。

如何修改我的xml,以便当我点击按钮时,按钮点击应该成功发生?

我的xml如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:seekarc="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.test.MainActivity" >

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Switch On"
    android:id = "@+id/onbtn"
    android:layout_centerHorizontal="true" />

 <com.triggertrap.seekarc.SeekArc
    android:id="@+id/seekArc"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:padding="30dp"
    seekarc:rotation="180"
    seekarc:startAngle="30"
    seekarc:sweepAngle="300"
    seekarc:touchInside="true" />


</RelativeLayout>

2 个答案:

答案 0 :(得分:2)

我怀疑你的SeekArc是否覆盖了按钮。您使用的是RelativeLayout,因此您需要提及SeekArc必须位于按钮下方。更改seekarc代码如下:

<com.triggertrap.seekarc.SeekArc
    android:id="@+id/seekArc"
    android:layout_below="@+id/onbtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:padding="30dp"
    seekarc:rotation="180"
    seekarc:startAngle="30"
    seekarc:sweepAngle="300"
    seekarc:touchInside="true" />

答案 1 :(得分:0)

您有 RelativeLayout ,因此如果您想将 SeekArc 放在按钮下方,请添加 android:layout_below =& #34; @ id / onbtn&#34; 属性为 SeekArc