Android SlidingDrawer默认是打开的

时间:2015-06-26 13:54:50

标签: android slidingdrawer

我使用SlidingDrawer创建一个菜单。

在这个SlidingDrawer中有很多项目(ImageViews,EditText,TextViews等)。

问题在于,有时当我打开Activity时,即使我没有为此编写特定代码,我也发现我的SlidingDrawer已经打开。

同样在我的清单中我写了这一行:

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

但是SlidingDrawer仍然可见。正如我之前所说,奇怪的是,有时SlidingDrawer已经打开,有时候不会打开!

这是我的SlidingDrawer的完整XML代码:

<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>

有什么建议吗?

0 个答案:

没有答案