Как настроить библиотеку com.coboltforge.slidemenuexample в Android?

Мне нужно реализовать этот макет в моем проекте. Сдвижной ящик работает хорошо для меня, вместо того, чтобы, когда я настроил слайд-файл com.coboltforge.slidemenuexample, он перестает работать. После того, как ящик был установлен, как показано, нажав кнопку действия на панели действий, он остается открытым и не закрывается. Что я хочу сделать, это "открыть другое действие без фрагмента в событии onClick imageView1"? Я не знаю, как это сделать. Любая помощь будет оценена.

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <View 
        android:layout_width="250dp"
        android:layout_height="1dp"
        android:background="#a8a8a8" />

    <RelativeLayout
        android:layout_width="250dp"
        android:layout_height="48dp"
        android:paddingRight="15dp"
        android:paddingLeft="20dp"
        android:background="#000000" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_centerVertical="true"
            android:textStyle="bold"
            android:textColor="#ffffff"
            android:text="Demo Mode" />

        <View 
            android:layout_width="1dp"
            android:layout_height="fill_parent"
            android:layout_marginLeft="20dp"
            android:layout_toLeftOf="@+id/imageView1"
            android:background="#a8a8a8" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:src="@drawable/settings_icon"
            android:layout_marginLeft="15dp"
            android:contentDescription="@null" />

    </RelativeLayout>

    <View 
        android:layout_width="250dp"
        android:layout_height="1dp"
        android:background="#a8a8a8" />

    <View 
        android:layout_width="250dp"
        android:layout_height="20dp"
        android:background="#000000" />

    <LinearLayout
        android:layout_width="250dip"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

        <ListView
            android:id="@+id/menu_listview"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"            
            android:divider="@android:color/darker_gray"            
            android:dividerHeight="1dip"
            android:background="#000000" />

    </LinearLayout>

    <FrameLayout
        android:id="@+id/overlay"        
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>

</LinearLayout>

1 ответ

Я просто прикрепил кликабельный атрибут и атрибут onClick(для вызова метода для открытия действия) к ImageView в его XML-макете, и он работал без проблем для меня. Ранее я пытался прикрепить onClickListener из Java-файла, и это не работает для меня.

<ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:src="@drawable/settings_icon"
                android:layout_marginLeft="15dp"
                android:clickable="true"
                android:onClick="openSettingsIconActivity"
                android:contentDescription="@null" />
Другие вопросы по тегам