내부에 여러 개의보기가 포함 된 사용자 정의 framelayout을 만들었습니다. 레이아웃을 클릭하면 레이아웃 내부에서 일부 애니메이션이 수행됩니다. 나는 아래로 내 XML로 레이아웃의 두 인스턴스를 만들었습니다사용자 정의 레이아웃 이상한 동작
내 메인 클래스에서 이러한 레이아웃을 정의한 후, 때 내가 처음 레이아웃을 클릭 것으로, 애니메이션에 무슨 일이 일어나고<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="19dp"
android:orientation="vertical" >
<com.example.MyProj
android:id="@+id/frame1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="19dp"
android:layout_marginRight="28dp"
android:clickable="true" >
</com.example.MyProj>
<com.example.MyProj
android:id="@+id/frame2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:clickable="true" >
</com.example.MyProj>
</LinearLayout>
이제 여기서 이상한 행동입니다 두 번째 레이아웃 즉, 내가 frame1을 클릭하면, 프레임 2가 움직입니다. 클릭하면 두 번째 레이아웃이 잘 응답합니다. 따라서 최근에 정의 된 레이아웃이 애니메이션으로 바뀌고 있습니다. 먼저 정의 된 레이아웃이 애니메이션으로 표시되지 않습니다. 이러한 레이아웃은 이런 식으로 행동하는 이유
final MyProj fl = (MyProj) findViewById(R.id.frame1);
final MyProj fl1 = (MyProj) findViewById(R.id.frame2);
fl.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
fl.reset();
fl.animation();
}
});
fl1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
fl.reset();
fl1.animation();
}
});
누군가가 설명해 주 시겠어요 :
이것은 내 메인 클래스의 레이아웃을 정의하는 방법이다? 미리 감사드립니다.
com.example.MyProj? – traninho