【发布时间】:2015-02-25 15:43:16
【问题描述】:
我正在尝试制作一个应该看起来像这样的布局。
我正在使用来自github 的 TriggerTrap/SeekArc。这是我的 xml。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:seekarc="http://schemas.android.com/apk/res/com.triggertrap.sample"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/black"
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=".MainActivity" >
<FrameLayout
android:id="@+id/seekArcContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<com.triggertrap.seekarc.SeekArc
android:id="@+id/seekArc1"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center"
android:padding="20dp"
seekarc:arcColor="#808080"
seekarc:clockwise="true"
seekarc:max="500"
seekarc:progressColor="@android:color/white"
seekarc:rotation="275"
seekarc:startAngle="0"
seekarc:sweepAngle="175"
seekarc:thumb="@drawable/custom_seek_arc_control_selector"
seekarc:touchInside="false" />
<com.triggertrap.seekarc.SeekArc
android:id="@+id/seekArc2"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:padding="20dp"
seekarc:arcColor="#808080"
seekarc:clockwise="true"
seekarc:max="500"
seekarc:progressColor="@android:color/white"
seekarc:rotation="95"
seekarc:startAngle="0"
seekarc:sweepAngle="175"
seekarc:thumb="@drawable/custom_seek_arc_control_selector"
seekarc:touchInside="false" />
<Button
android:id="@+id/btn"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:background="@drawable/scrubber_pressed"/>
</FrameLayout>
</LinearLayout>
现在,问题是,因为我使用的是框架布局,所以只有一个 seekarc 是可点击的。 如果我将 seekarc 更改为线性布局,整个布局就会像这样扭曲。
现在一切都可以点击了,但设计已经完成。谁能告诉我如何使它工作,以便 按钮以及 seekarc 都是可触摸的,并且设计不受影响。
【问题讨论】:
-
哇,提供你 51.5% 的声誉。你肯定想得到答案
-
是的!我需要答案。
-
@Akshat Android 中除了 LinearLayout 和 FrameLayout 之外还有其他的布局。您应该在您的情况下使用 RelativeLayout 并将两个搜索栏定位为@,使它们中的两个垂直放置(在其中一个搜索栏上使用 layout_below 或 layout_above)。
-
由于
SeekArc视图似乎占用了整个圆的空间,而不管可见弧线如何,您可能需要扩展FrameLayout并覆盖触摸调度程序以将事件调度到正确的孩子。
标签: java android xml android-layout