我有一個包含ListView
的滑動窗格佈局。我有一個按鈕來打開滑動窗格。所以我想禁用這個滑動窗格的滑動手勢,當我嘗試訪問同一個佈局中的任何其他視圖時,這會產生問題。爲SlidingPaneLayout禁用滑動手勢
是否有反正只能使滑動手勢被禁用,並有按鈕功能應該工作?它應該像平常一樣按下按鈕來打開和關閉滑動窗格。
下面是我的XML佈局的一部分:
<android.support.v4.widget.SlidingPaneLayout
android:id="@+id/sliding_pane_layout_accountHome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" >
<LinearLayout
android:layout_width="280dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFFFF">
<ListView
android:id="@+id/lv_menuList"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</android.support.v4.widget.SlidingPaneLayout>
這裏是
slidingLayout1 = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout_accountHome);
slidingLayout1.openPane();
iv_menu=(ImageView)findViewById(R.id.iv_menu);
iv_menu.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v)
{
if(slidingLayout1.isOpen()==true)
{
slidingLayout1.closePane();
}
else
{
slidingLayout1.openPane();
}
}
});
感謝編輯@rummler –