Android SlidingDrawer is opened by default

74 views Asked by At

I create a menu using SlidingDrawer.

In this SlidingDrawer there are many items (ImageViews, EditText, TextViews etc.).

The problem is that sometimes when I open the Activity, I find my SlidingDrawer already opened even if I did not write specific code for this.

Also in my manifest i wrote this line:

<activity android:name="ActMain" android:label="@string/app_name" android:screenOrientation="landscape"
                android:windowSoftInputMode="stateHidden" />

But the SlidingDrawer still remain visible. The strange thing, as I said before, is that sometimes the SlidingDrawer is already opened, sometimes not!

Here's the complete XML code of my SlidingDrawer:

<SlidingDrawer
        android:id="@+id/slide_bottomTrack"
        android:layout_width="@dimen/dim_BottomLunghezza"
        android:layout_height="match_parent"
        android:layout_marginTop="150dp"
        android:content="@+id/content_bottomTrack"
        android:handle="@+id/handle_bottomTrack"
        android:orientation="vertical"
        android:layout_alignParentBottom="true"
        android:layout_toLeftOf="@+id/slide_bottomSave"
        android:layout_toStartOf="@+id/slide_bottomSave"
        android:layout_marginRight="@dimen/dim_Quindici"
        android:layout_marginEnd="@dimen/dim_Quindici"
        android:focusable="true" 
        android:focusableInTouchMode="true"
        >

        <RelativeLayout 
            android:id="@+id/handle_bottomTrack"
            android:layout_width="fill_parent"
            android:layout_height="@dimen/dim_BottomAltezza"
            android:background="@drawable/bg_black_bottom"
            android:padding="0dp"
            >

            <RelativeLayout
                android:id="@+id/handle_bottomTrackMain"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@drawable/bg_black_bottom"
                android:visibility="visible"
                >
                <ImageView
                    android:id="@+id/main_imgTrack"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:contentDescription="@string/icon"
                    android:src="@drawable/icon_orologio_bianco"
                    android:layout_gravity="center"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_centerVertical="true"
                    />

                <TextView
                    android:id="@+id/main_txtTrack"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/main_bottomTrack"
                    android:textColor="@color/color_ABText"
                    android:textSize="@dimen/dim_ABText"
                    android:gravity="center"
                    android:layout_toRightOf="@+id/main_imgTrack"
                    android:layout_toEndOf="@+id/main_imgTrack"
                    android:layout_marginLeft="@dimen/dim_Venti"
                    android:layout_marginStart="@dimen/dim_Venti"
                    android:layout_centerVertical="true"
                    />
            </RelativeLayout> 

            <RelativeLayout
                android:id="@+id/handle_bottomTrackMxAB"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/bg_black_bottom"
                android:visibility="gone"
                android:padding="0dp"
                >  

                <TextView
                    android:id="@+id/main_numMxABCat"
                    android:layout_width="@dimen/dim_BottomAltezza"
                    android:layout_height="@dimen/dim_BottomAltezza"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:background="@color/color_Red"
                    android:textColor="@color/color_White"
                    android:textSize="@dimen/dim_ABText"
                    android:gravity="center"
                    />

                <TextView
                    android:id="@+id/main_txtMxABCat"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/main_bottomMxABCat"
                    android:textColor="@color/color_ABText"
                    android:textSize="@dimen/dim_ABText"
                    android:gravity="center"
                    android:layout_toRightOf="@+id/main_numMxABCat"
                    android:layout_toEndOf="@+id/main_numMxABCat"
                    android:layout_marginLeft="@dimen/dim_Venti"
                    android:layout_marginStart="@dimen/dim_Venti"
                    android:layout_centerVertical="true"
                    />

            </RelativeLayout>
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/content_bottomTrack"
            android:layout_width="100dp"
            android:layout_height="500dp"
            android:background="@color/color_Black2"
            android:visibility="gone"
            >  

            <RelativeLayout
                android:id="@+id/content_bottomTrackMain"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:visibility="visible"
                android:padding="8dp"
                >   

                <ImageView
                    android:id="@+id/img_startTrack"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:contentDescription="@string/icon"
                    android:src="@drawable/icon_track_start"
                    android:layout_gravity="center"
                    android:layout_alignParentTop="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_marginLeft="@dimen/dim_Quindici"
                    android:layout_marginStart="@dimen/dim_Quindici"
                    android:layout_toLeftOf="@+id/view_Track"
                    android:layout_toStartOf="@+id/view_Track"
                    android:layout_marginTop="@+dimen/dim_Quindici"
                    />

                <View 
                    android:id="@+id/view_Track"
                    android:layout_width="1dp"
                    android:layout_height="1dp"
                    android:layout_alignParentTop="true"
                    android:layout_centerHorizontal="true"
                    />

                <ImageView
                    android:id="@+id/img_stopTrack"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:contentDescription="@string/icon"
                    android:src="@drawable/icon_track_stop"
                    android:layout_gravity="center"
                    android:layout_alignParentTop="true"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentEnd="true"
                    android:layout_marginRight="@dimen/dim_Quindici"
                    android:layout_marginEnd="@dimen/dim_Quindici"
                    android:layout_toRightOf="@+id/view_Track"
                    android:layout_toEndOf="@+id/view_Track"
                    android:layout_marginTop="@+dimen/dim_Quindici"
                    />

                <EditText
                    android:id="@+id/txt_nameTrack"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_below="@+id/img_startTrack"
                    android:hint="@string/main_salvatrack"
                    android:layout_marginTop="@+dimen/dim_Quindici"
                    android:textSize="12sp"
                    android:background="@drawable/edittext_rounded"
                    android:padding="5dp"
                    />

                <View 
                     android:id="@+id/view_track"
                     android:layout_width="1dp"
                     android:layout_height="1dp"
                     android:layout_alignParentTop="true"
                     android:layout_centerHorizontal="true"
                     android:layout_marginLeft="2dp"
                     android:layout_marginRight="2dp"
                     />

                <TextView
                    android:id="@+id/btn_confermaTrack"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/txt_nameTrack"
                    android:text="@string/main_confermatrack"
                    android:layout_centerHorizontal="true"
                    android:textSize="12sp"
                    android:textColor="@color/color_White"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentEnd="true"
                    android:layout_marginTop="@+dimen/dim_Dieci"
                    android:background="@drawable/bg_btn_green"
                    android:gravity="center"
                    android:textStyle="bold"
                    android:layout_toRightOf="@+id/view_track"
                    android:layout_toEndOf="@+id/view_track"
                    />


                <TextView
                    android:id="@+id/lbl_aggiornaTrack"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/btn_confermaTrack"
                    android:text="@string/main_aggiornatrack"
                    android:textSize="14sp"
                    android:textColor="@color/color_White"
                    android:layout_marginTop="@+dimen/dim_Quindici"
                    android:gravity="start"
                    android:textStyle="bold"
                    />

                <EditText 
                    android:id="@+id/txt_serachTrack"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/lbl_aggiornaTrack"
                    android:hint="@string/main_searchmain"
                    android:inputType="text"
                    android:layout_marginTop="@dimen/dim_Quindici"
                    android:textSize="12sp"
                    android:background="@drawable/edittext_rounded"
                    android:padding="5dp"
                    />

                <ListView 
                    android:id="@+id/list_serachTrack"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_below="@+id/txt_serachTrack"
                    android:layout_marginTop="@dimen/dim_Dieci"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:listSelector="@android:color/transparent"
                    android:dividerHeight="0dp"
                    android:divider="@null"
                    android:background="@color/color_White"
                    />

            </RelativeLayout>  

            <RelativeLayout
                android:id="@+id/content_bottomTrackMxAB"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@color/color_Red"
                android:visibility="gone"
                >  

                <ListView
                    android:id="@+id/btm_list_selCat"
                    android:cacheColorHint="#00000000"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:fadingEdge="none"
                    android:dividerHeight="0dp"
                    android:divider="@null"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:listSelector="@android:color/transparent"
                    android:layout_marginTop="@dimen/dim_Dieci"
                />

        </RelativeLayout>

    </RelativeLayout>

</SlidingDrawer>

Any suggestions?

0

There are 0 answers