내가 작업중인 앱은 화면을 채우는 하나의 큰 맞춤보기로 구성되어 있습니다. 그 방향으로 그려진 객체를 이동하는 데 사용할 수있는 사용자 정의보기의 각면 가운데에 버튼 하나를 배치했습니다. 커스텀 뷰를 카메라의 "뷰 파인더"라고 생각하면 4면 모두 버튼으로 뷰 파인더를 패닝 할 수 있기를 바랍니다.보기 상단에 단추를 그리는 가장 효율적인 방법은 무엇입니까?
버튼이 완벽하게 작동하지만 단추를 누르면 사용자 정의보기가 많이 다시 그려지고 (1 대신 4 다시 그리기) UI가 상당히 지연됩니다.
단추의 애니메이션 때문에 사용자 지정보기를 다시 그릴 수있는 방법이 있습니까?
나는 명백한 것을 놓치고 있다면 용서해주십시오.
사전 도움을 주셔서 감사합니다 ... Android rocks !!!
XML 레이아웃 :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.app.CustomView
android:id="@+id/CustomView" android:layout_above="@+id/menuButton" android:layout_height="fill_parent" android:layout_width="fill_parent"/>
<Button android:layout_height="wrap_content" android:layout_below="@+id/CustomView" android:layout_width="wrap_content" android:layout_alignRight="@+id/CustomView" android:id="@+id/toolsButton" android:text="Tools" android:textSize="24sp"></Button>
<Button android:layout_height="wrap_content" android:id="@+id/outButton" android:text="-" android:textSize="30sp" android:layout_toLeftOf="@+id/inButton" android:layout_alignTop="@+id/inButton" android:layout_width="40sp"></Button>
<Button android:layout_height="wrap_content" android:layout_alignRight="@+id/CustomView" android:layout_alignBottom="@+id/CustomView" android:text="+" android:textSize="30sp" android:id="@+id/inButton" android:layout_width="wrap_content"></Button>
<Button android:layout_alignTop="@+id/CustomView" android:layout_centerHorizontal="true" android:layout_height="40sp" android:layout_width="60sp" android:text="^" android:id="@+id/upButton"></Button>
<Button android:layout_alignBottom="@+id/CustomView" android:layout_centerHorizontal="true" android:text="v" android:layout_height="40sp" android:layout_width="60sp" android:id="@+id/downButton"></Button>
<Button android:layout_alignRight="@+id/CustomView" android:text=">" android:id="@+id/rightButton" android:layout_height="60sp" android:layout_width="40sp" android:layout_centerVertical="true"></Button>
<Button android:id="@+id/leftButton" android:text="<" android:layout_height="60sp" android:layout_width="40sp" android:layout_centerVertical="true"></Button>
<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignLeft="@+id/CustomView" android:id="@+id/menuButton" android:textSize="24sp" android:text="Functions" android:layout_alignParentBottom="true"></Button>
</RelativeLayout>
죄송합니다. 명확하지 않은 경우 버튼은 레이아웃의 일부이며 사용자 정의보기가 아니지만 사용자 정의보기의 맨 위에 있습니다. –
버튼을 누를 때 사용자 정의보기가 무효화됩니까? – user432209
나이지만 로그에 원하는대로 1 번 대신 사용자 정의보기가 4 번 다시 그려진다는 것을 알 수있다. 버튼을 눌렀을 때 다시 그리기를하지 못하게하고 대신 프레스 후에 수동으로보기를 무효화하지 않도록하고 싶다. . –