0

I have a sliding drawer, which slide from bottom to top. But on orientation change, I want it to slide from right to left as there is less place in bottom in landscape view. My layout file is as follow:

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

I read this, but didn't worked for me.

Any clue how can I achieve that ?

Community
  • 1
  • 1
hemu
  • 3,199
  • 3
  • 44
  • 66
  • Hello ,Hemu i had R&D on it.we can have two choice either bottom to top and left to right . if your relay need more then you have to create your own. what you relay want share me – Chintan Khetiya Oct 31 '12 at 07:52
  • Ok....In that case can I have it from left to right when Orientation is landscape (May be from coding, in onConfigurationChanged event writting some code to change the Drawer to slide from left to right) ? – hemu Oct 31 '12 at 07:58
  • ok for that you have to find that when orientation change you have to change your view screen or you can set by default for both portrait and orientation. see this link will http://blog.sptechnolab.com/2011/02/10/android/android-sliding-drawer/ guide you and let me know if you have any more query. – Chintan Khetiya Oct 31 '12 at 08:01

0 Answers0