Ich versuche, das Symbol auf dem Handle zu ändern, wenn ich versuche, die Slideshower zu öffnen. Wenn ich das Handle aus der Sicht extrahiere und den onclicklistener oder den ontouchlistener einstellt, scheint es nie ein trigget zu bekommen.So ändern Sie das Symbol im SlidingDrawer-Handle, wenn Sie darauf klicken
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SlidingDrawer drawer = (SlidingDrawer)findViewById(R.id.drawer_landscape);
ImageView handle = (ImageView)findViewById(R.id.handle_l);
handle.setFocusable(true);
handle.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.i("test","onClick");
}
});
}
Und meine XML
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/base_frame_layout"
android:layout_gravity="bottom"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
<SlidingDrawer
android:id="@+id/drawer_landscape"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:handle="@+id/handle_l"
android:content="@+id/content"
android:orientation="vertical"
android:visibility="visible"
>
<ImageView
android:id="@+id/handle_l"
android:layout_height="50px"
android:layout_width="64px"
android:padding="0px"
android:src="@drawable/icon"
/>
<TextView
android:id="@+id/content"
android:text="content"
android:layout_height="50px"
android:layout_width="64px"
/>
</SlidingDrawer>
</FrameLayout>
Ich hatte gehofft, dass dieser Code sollte "onClick" -Meldung einzuloggen, aber es funktioniert nicht.
Irgendwelche Ideen?
Wie sieht Ihre XML-Animationsdatei aus? – zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz