私はイメージを持っています:
この画像は、seekArc (円形化された seekBar、ここにあります)の背景として設定されています。
問題は、作成した画像を seekArc ビューの背景に設定したときです。それは seekArc の実際のアークを超えて拡張されます。これで見られるように
XML コード:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
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=".MainActivity" >
<com.triggertrap.seekarc.SeekArc
android:id="@+id/SeekArc1"
android:layout_width="500dp"
android:layout_height="500dp"
android:layout_alignBottom="@+id/hometemp"
android:layout_alignParentRight="true"
android:background="@drawable/largepower"
android:padding="85dp"
seekarc:arcWidth="3dp"
seekarc:max="100"
seekarc:rotation="180"
seekarc:startAngle="30"
seekarc:sweepAngle="300"
seekarc:touchInside="true" />
<com.triggertrap.seekarc.SeekArc
android:id="@+id/SeekArc01"
android:layout_width="500dp"
android:layout_height="500dp"
android:layout_alignLeft="@+id/homepower"
android:layout_alignTop="@+id/SeekArc1"
android:padding="85dp"
seekarc:arcWidth="3dp"
seekarc:max="100"
seekarc:rotation="180"
seekarc:startAngle="30"
seekarc:sweepAngle="300"
seekarc:touchInside="true" />
<ProgressBar
android:id="@+id/hometemp"
style="@style/tallerBarStyle"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:maxHeight="50dp" />
<Switch
android:id="@+id/homepower"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/SeekArc01"
android:text="Power" />
</RelativeLayout>
フラグメントコード:
homeFragmentView = viewInflation.inflate(R.layout.homefragment_page,
container, false);
temp = (ProgressBar) homeFragmentView.findViewById(R.id.hometemp);
power = (Switch) homeFragmentView.findViewById(R.id.homepower);
s1 = (SeekArc) homeFragmentView.findViewById(R.id.SeekArc1);
s2 = (SeekArc) homeFragmentView.findViewById(R.id.SeekArc01);
Resources res = homeFragmentView.getResources();
Drawable drawable = res.getDrawable(R.drawable.largepower);
if (drawable.equals(null)) {
Toast.makeText(getActivity().getBaseContext(), "NULL", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getActivity().getBaseContext(), "NOT NULL", Toast.LENGTH_LONG).show();
s1.setBackground(drawable);
}
seekArc を画像の周りに移動させるための良い方法は何でしょうか?