简体   繁体   中英

LinearLayout Buttons not appearing when device orientation changed to Horizontal?

Here is the xml in which ScrollView layout size will vary means it will zoom image on button click but my top headers and footer will always be in same position irrespective of zoom values.......

XML

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


   <LinearLayout 
        android:id="@+id/layout_zoom_buttons"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

      <ImageView
          android:id="@+id/btn_zoomIn"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="1"

          android:src="@drawable/zoomin1" />
       <ImageView
             android:id="@+id/btn_zoomout"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:src="@drawable/zoomin1" />


     </LinearLayout>  
     <ScrollView
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
        >
          <com.example.imagetouchview.TouchImageView
            android:id="@+id/imagezoom"
            android:layout_width="fill_parent"
            android:layout_height="400dp"
             android:layout_gravity="center"> 
           </com.example.imagetouchview.TouchImageView>     
            </ScrollView>
    <LinearLayout
        android:id="@+id/layout_buttons"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"


        android:orientation="horizontal" >

    <ImageView 
        android:id="@+id/btn_email_fatwa"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
       android:src="@drawable/zoomin1"
        android:layout_weight="1"/>    
     <ImageView 
        android:id="@+id/btn_share_fatwa"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/zoomin1"
        android:layout_weight="1"/> 
        <ImageView 
        android:id="@+id/btn_save_fatwa"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
         android:src="@drawable/zoomin1"
        android:layout_weight="1"/>    


    </LinearLayout>    


</LinearLayout> 

this layout is fine in vertical orientation while when device orientatio changes to Horizontal the bottom buttons are invisible.I am following Salmans Ayub Answer For Image Zoomin and Out

I think You have design your layout in portrait mode(verticaly). Now either you have to bound it for portrait mode by adding this line android:screenOrientation="portrait" in your activity manifest,

OR

You have to design it for landscape mode by following this link- Android: alternate layout xml for landscape mode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM