我在使用 Slidingdrawer 时遇到了一些问题。如何修复它。
主要 XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/white">
<SlidingDrawer
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/black"
android:handle="@+id/handle"
android:id="@+id/slideD">
<Button
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@id/handle"
android:background="@drawable/arrow_up"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/ic_launcher"
>
</Button>
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/ic_launcher"
>
</Button>
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
活动
public class ATDTActivity extends Activity {
SlidingDrawer slideD;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
slideD = (SlidingDrawer)findViewById(R.id.slideD);
slideD.setOnDrawerOpenListener(new OnDrawerOpenListener(){
@Override
public void onDrawerOpened() {
slideD.getHandle().setBackgroundResource(R.drawable.arrow_down);
}
});
slideD.setOnDrawerCloseListener(new OnDrawerCloseListener(){
@Override
public void onDrawerClosed() {
sideD.getHandle().setBackgroundResource(R.drawable.arrow_up);
}
});
}
}
谢谢帮忙!。您的帖子没有太多上下文来解释代码部分;请更清楚地解释您的情况。