Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓:更换滑动抽屉';s在横向方向上的滑动方向_Android_Android Layout_Slidingdrawer - Fatal编程技术网

Android 安卓:更换滑动抽屉';s在横向方向上的滑动方向

Android 安卓:更换滑动抽屉';s在横向方向上的滑动方向,android,android-layout,slidingdrawer,Android,Android Layout,Slidingdrawer,我有一个滑动抽屉,可以从下到上滑动。 但在方向改变时,我希望它从右向左滑动,因为在横向视图中底部的位置较少。 我的布局文件如下所示: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation=

我有一个滑动抽屉,可以从下到上滑动。 但在方向改变时,我希望它从右向左滑动,因为在横向视图中底部的位置较少。 我的布局文件如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="#d9d9d9">

    <!-- <RelativeLayout 
        android:id="@+id/header1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="1dp"
        android:background="#999999"> -->

    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/menubar_appointments"
        android:layout_alignParentTop="true"
        android:padding="0dp" >

        <ImageView 
            android:id="@+id/imgApptBack"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_centerVertical="true"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="3dip"
            android:src="@drawable/icon_titlebar_back"
            android:padding="0dp"
            android:clickable="true"
            android:onClick="goBack"/>

        <TextView 
            android:id="@+id/titleApptName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/item_appointment"
            android:textSize="18sp"
            android:textColor="#FFFFFF"
            android:textStyle="bold"
            android:padding="2dp"
            android:typeface="sans"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"/>

        <ImageView 
            android:id="@+id/imgTitlebarShar"
            android:src="@drawable/icon_titlebar_share"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_marginRight="3dp"
            android:padding="0dp"
            android:clickable="true"/>

    </RelativeLayout>
    <!-- </RelativeLayout> -->

    <!-- Header End -->

    <LinearLayout 
        android:id="@+id/pastapptmntLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:layout_margin="10dp"
        android:orientation="vertical"
        android:background="@drawable/upapptmnt_bg"
        android:layout_below="@+id/header">

    <RelativeLayout 
        android:id="@+id/layoutForPassAppt"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_margin="10dp">

        <TextView 
            android:id="@+id/txtApptTime"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="15sp"
            android:textColor="@android:color/black"
            android:gravity="center"
            android:layout_marginTop="5dp"
            android:layout_centerHorizontal="true"
            android:text="This is Test Text"/>

        <TextView 
            android:id="@+id/txtApptWith"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="13sp"
            android:textColor="@android:color/black"
            android:gravity="center"
            android:layout_marginTop="8dp"
            android:layout_centerHorizontal="true"
            android:layout_below="@+id/txtApptTime"
            android:text="This is test"/>

        <LinearLayout 
             android:layout_width="match_parent"
             android:layout_height="wrap_content" 
             android:orientation="horizontal"
             android:layout_centerHorizontal="true"
             android:gravity="center_horizontal"
             android:layout_below="@+id/txtApptWith"
             android:layout_marginTop="7dp" >

                <TextView 
                    android:id="@+id/txtApptType"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="13sp"
                    android:textColor="@android:color/darker_gray"
                    android:text="Your appointment is:"/>

                 <TextView 
                    android:id="@+id/txtApptConfirmedOrNot"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="3dp"
                    android:text="Confirmed"
                    android:textSize="12sp"
                    android:textColor="#006000" />
          </LinearLayout>

    </RelativeLayout>

    <RelativeLayout 
        android:id="@+id/ForpastApptBelow"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:layout_margin="5dp">

        <LinearLayout 
            android:id="@+id/pastapptbelowUP"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_marginTop="5dp" >

               <TextView 
                   android:id="@+id/txtDirections"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:text="Directions:"
                   android:textSize="12sp"
                   android:textColor="@android:color/black"
                   android:layout_marginLeft="5dp"
                   android:typeface="sans"/>

               <ImageView 
                   android:id="@+id/imgDirections"
                   android:layout_width="wrap_content"
                   android:layout_height="19dp"
                   android:layout_marginLeft="1dp" 
                   android:src="@drawable/direction"
                   android:layout_gravity="center_vertical"/>

               <TextView 
                   android:id="@+id/txtPhone"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:textSize="12sp"
                   android:textColor="@android:color/black"
                   android:text="Phone:"
                   android:layout_marginLeft="40dp"
                   android:typeface="sans"/>

               <TextView 
                   android:id="@+id/txtPhoneNumber"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:textSize="12sp"
                   android:textColor="#00699E"
                   android:text="555-555-555"
                   android:textStyle="bold"
                   android:typeface="sans"
                   android:layout_marginLeft="5dp"/>

          </LinearLayout>


          <LinearLayout 
             android:id="@+id/forremind"
             android:layout_width="match_parent"
             android:layout_height="wrap_content" 
             android:orientation="horizontal"
             android:layout_centerHorizontal="true"
             android:gravity="center_horizontal"
             android:layout_below="@+id/pastapptbelowUP"
             android:layout_marginTop="20dp"
             >

                   <TextView 
                       android:id="@+id/lblRemind"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:textColor="@android:color/black"
                       android:textSize="12sp"
                       android:text="Please remind me:"
                       android:typeface="sans" />

                   <TextView
                        android:id="@+id/txtReminder"
                        android:background="@drawable/comboboximage"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"  
                        android:text="Please Remind Me"                     
                        android:clickable="true"
                        android:gravity="center"
                        android:textSize="12sp"
                        android:textColor="@android:color/black"
                        android:typeface="sans"
                        android:layout_marginLeft="10dp"
                        android:onClick="getReminderView"/>

         </LinearLayout> 



    </RelativeLayout>    


    </LinearLayout>



    <!-- <TextView 
        android:id="@+id/txtAppointment_DrName"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="13sp"
        android:textColor="#555555"
        android:typeface="sans"
        android:layout_marginTop="10dip"
        android:layout_marginLeft="7dip"
        android:layout_gravity="left"
        android:gravity="top|left" /> -->

    <LinearLayout 
        android:id="@+id/MyNotes"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="7dip"
        android:layout_marginRight="7dip"
        android:background="@drawable/appointment_rounded_corner_dark"
        android:layout_marginTop="5dip"
        android:layout_below="@+id/pastapptmntLayout">

       <TextView 
        android:id="@+id/txtAppointment_MyNotes"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/title_my_notes"
        android:textSize="17sp"
        android:textStyle="bold"
        android:textColor="#FFFFFF"
        android:typeface="sans"
        android:layout_marginTop="0dip"
        android:layout_marginLeft="0dip"
        android:gravity="center_horizontal"
        android:paddingTop="3dip"
        android:paddingBottom="3dip"
        android:background="#56A5EC" />

            <EditText
                    android:id="@+id/txtNotes"
                    android:layout_width="match_parent"
                    android:layout_height="130dp"
                    android:layout_margin="7dp"
                    android:background="@drawable/edittext"
                    android:singleLine="false"
                    android:textSize="13sp"
                    android:inputType="textImeMultiLine|textCapSentences"
                    android:gravity="top|left" >
                </EditText>

       <!--  <View android:id="@+id/divider" android:background="@drawable/shap_appointment"
            android:layout_width="match_parent" android:layout_height="5sp"
            android:layout_below="@+id/MyNotes"/> -->
     </LinearLayout>   



<!-- <LinearLayout 
    android:layout_height="200dp"
    android:layout_width="fill_parent"
    android:baselineAligned="false"
    android:layout_below="@+id/pastapptmntLayout"
    android:layout_alignParentBottom="true"> -->

    <android.widget.SlidingDrawer
        android:id="@+id/reminderSlidingDrawer"
        android:handle="@+id/handle"
        android:content="@+id/reminderContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_below="@+id/pastapptmntLayout"        
        >

        <Button 
            android:id="@+id/handle"
            android:visibility="invisible"
            android:layout_width="0px" 
            android:layout_height="0px"         
            />

        <LinearLayout
            android:id="@+id/reminderContainer"   
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_marginTop="5dp"                        
            android:background="@drawable/layout_wheel_bg">


            <Button
                android:id="@+id/setReminderVtn"
                android:layout_gravity="top|right"
                android:text="Done"
                textSize="12sp"
                android:textColor="#FFFFFF"
                android:background="@drawable/menu_bar_button"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:onClick="setReminder"
                android:layout_marginBottom="40dp"                                      
                />

            <kankan.wheel.widget.WheelView android:id="@+id/reminder"
            android:layout_height="wrap_content"
            android:layout_width="200dp"
            android:layout_gravity="center"                 
            />


        </LinearLayout>    

     </android.widget.SlidingDrawer> 
   <!-- </LinearLayout>    --> 
</RelativeLayout>

,但对我不起作用


有什么线索可以让我做到吗?

你好,河姆,我有研发人员。我们有两种选择,从下到上和从左到右。如果你的继电器需要更多,那么你必须创建自己的继电器。您想要的内容共享我好的……在这种情况下,当方向为横向时,我可以从左到右使用它吗(可能来自编码,在OnConfiguration Changed事件中写入一些代码以将抽屉从左到右滑动)?对于这一点,您必须发现,当方向改变时,您必须改变视图屏幕,或者您可以默认设置纵向和方向。查看此链接将指导您,如果您还有任何疑问,请告诉我。