2017-06-09 17 views
0

**我面臨的問題,請您及時看到屏幕拍攝** Android Landscape mode cutting off my bottomAndroid的橫向模式切斷了我的佈局上bootom

,我想這

overlap my sendbox view on tab layout

**我發送箱佈局XML代碼是**

<RelativeLayout 

    android:layout_marginTop="10dp" 
    android:visibility="invisible" 
    android:layout_centerVertical="true" 
    android:id="@+id/sendbox" 
    android:layout_centerHorizontal="true" 
    android:background="@drawable/sdboxx" 
    android:layout_width="280dp" 
    android:layout_height="330dp"> 

    <RelativeLayout 
     android:layout_marginTop="2mm" 
     android:id="@+id/headerportion" 
     android:layout_marginLeft="2mm" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginRight="2mm" 
     > 
     <!-- android:shadowColor="#ffff" 
     android:shadowDx="0.5" 
     android:shadowDy="0.5" 
     android:shadowRadius="0.5"--> 
     <TextView 
      android:shadowColor="#ffff" 

      android:shadowRadius="1" 
      android:textSize="3mm" 
      android:layout_alignParentLeft="true" 
      android:textColor="#3951a3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/hide" 
      android:text="Hide" 
      /> 
     <TextView 

      android:shadowColor="#ffff" 
      android:shadowDx="1" 
      android:shadowDy="1" 
      android:shadowRadius="1" 
      android:textSize="3mm" 
      android:textStyle="bold" 
      android:layout_centerHorizontal="true" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="#603913" 
      android:text="MANHATTAN" 
      /> 
     <TextView 
      android:shadowColor="#ffff" 

      android:shadowRadius="1" 
      android:textSize="3mm" 

      android:id="@+id/upper_search_text" 
      android:layout_alignParentRight="true" 
      android:textColor="#3951a3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Search" 
      /> 
     <View 
      android:layout_below="@+id/upper_search_text" 
      android:id="@+id/line" 
      android:layout_width="fill_parent" 
      android:layout_height="1dp" 
      android:background="#603913" 

      /> 
     <TextView 
      android:shadowColor="#ffff" 
      android:shadowDx="1" 
      android:shadowDy="1" 
      android:shadowRadius="1" 
      android:id="@+id/bigtext" 
      android:layout_centerHorizontal="true" 
      android:layout_below="@+id/line" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textSize="3.5mm" 
      android:textColor="#603913" 
      android:text="Can I Park Here ?" 
      android:textStyle="bold" 
      /> 
     <LinearLayout 
      android:layout_marginLeft="2mm" 
      android:layout_marginRight="2mm" 
      android:orientation="vertical" 
      android:layout_below="@+id/bigtext" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 
      <LinearLayout 

       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 


       <EditText 
       android:id="@+id/house_number" 
        android:textAlignment="center" 
        android:textSize="10dp" 
        android:hint="Number" 
        android:inputType="number" 
        android:layout_weight=".75" 
        android:layout_width="12mm" 
        android:layout_height="3.5mm" 
        android:paddingLeft="10dp" 
        android:background="@drawable/edittext_bg"/> 
       <EditText 

        android:gravity="center_vertical|left" 
         android:maxLines="1" 
        android:id="@+id/street_full_name" 
        android:textSize="10dp" 
        android:hint="Street Full Name" 
        android:layout_weight=".75" 
        android:layout_marginLeft="1mm" 
        android:layout_width="30mm" 
        android:layout_height="3.5mm" 
        android:paddingLeft="10dp" 
        android:background="@drawable/edittext_bg"/> 

      </LinearLayout> 
      <LinearLayout 

       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 


       <TextView 

        android:shadowColor="#ffff" 
        android:shadowDx="1" 
        android:shadowDy="1" 
        android:shadowRadius="1" 
        android:layout_marginLeft="1mm" 
        android:text="Number" 
        android:layout_weight=".75" 
        android:layout_width="10mm" 
        android:layout_height="wrap_content" 
        android:textColor="#603913" 
        android:textSize="2mm" 
        android:textStyle="bold" 
        /> 
       <TextView 

        android:shadowColor="#ffff" 
        android:shadowDx="1" 
        android:shadowDy="1" 
        android:shadowRadius="1" 
        android:textSize="2mm" 
        android:textStyle="bold" 
        android:textColor="#603913" 
        android:layout_gravity="center_horizontal" 
        android:text="Street Full Name" 
        android:layout_weight=".75" 
        android:layout_marginLeft="7mm" 
        android:layout_width="28mm" 
        android:layout_height="wrap_content" 

        /> 

      </LinearLayout> 

      <TextView 

       android:paddingLeft="10dp" 
       android:gravity="center_vertical|left" 
       android:id="@+id/datepiker" 
       android:textSize="10dp" 
       android:hint=" 02/10/17 8:27PM" 
       android:background="@drawable/edittext_bg" 
       android:layout_width="match_parent" 
       android:layout_height="3.5mm" /> 
      <TextView 
       android:shadowColor="#ffff" 
       android:shadowDx="1" 
       android:shadowDy="1" 
       android:shadowRadius="1" 
       android:textSize="1mm" 
       android:textStyle="bold" 
       android:textColor="#603913" 
       android:layout_gravity="center_horizontal" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Date(MM/DD/YY) Hour(1-12)AM/PM" 

       /> 
      <ScrollView 
       android:layout_width="fill_parent" 
       android:layout_height="150dp" 
       android:background="@drawable/textview_bg" 
       android:fillViewport="true" 
       ><!-- <<<-&#45;&#45;&#45;&#45;&#45;&#45;added this line 

       >--> 
       <!-- android:paddingTop="10dp" 
       android:paddingLeft="10dp" 
       android:paddingRight="10dp" 
       android:paddingBottom="10dp"--> 

       <TextView 
        android:layout_gravity="fill" 
        android:paddingTop="8dp" 
        android:paddingLeft="8dp" 
        android:paddingRight="10dp" 
        android:paddingBottom="10dp" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/result" 
        android:textColor="#323232" 



        /> 
      </ScrollView> 

      /> 

      <TextView 
       android:layout_marginTop="1dp" 
       android:textSize="2mm" 
       android:shadowColor="#ffff" 
       android:shadowDx="1" 
       android:shadowDy="1" 
       android:shadowRadius="1" 
       android:textColor="#030000" 
       android:layout_gravity="center_horizontal" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="For more detail information," 
       android:textStyle="bold" 

       /> 
      <TextView 
       android:textSize="2mm" 
       android:shadowColor="#ffff" 
       android:shadowDx="1" 
       android:shadowDy="1" 
       android:shadowRadius="1" 
       android:textColor="#030000" 
       android:layout_gravity="center_horizontal" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Please refer to map symbols." 
       android:textStyle="bold" 
       android:layout_marginBottom="2dp" 
       /> 

     </LinearLayout> 
    </RelativeLayout> 



</RelativeLayout> 




<!--end send box--> 

我在我的主要活動中使用選項卡布局,我想重疊我的發送箱視圖上的選項卡欄。

**這是我Mapfragment XML **

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/Mapfrag" 
    tools:context=".Fragments.MapFragment"> 

    <!-- TODO: Update blank fragment layout --> 


    <com.mapbox.mapboxsdk.views.MapView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/mapview" 
     android:background="@drawable/mapbg" 
     app:zoomLevel="12.8" 
     app:centerLat="40.7694" 
     app:centerLng="-73.9597" 

     /> 

    <ImageView 
     android:id="@+id/p_massge" 
     android:layout_marginTop="20dp" 
     android:layout_marginLeft="20dp" 
     android:src="@drawable/p_symblee" 
     android:layout_width="7mm" 
     android:layout_height="7mm" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentLeft="true" 
     /> 
    <ImageView 
     android:layout_marginTop="20dp" 
android:id="@+id/stare" 
     android:layout_marginRight="18dp" 
     android:src="@drawable/favoritetowx" 
     android:layout_width="7mm" 
     android:layout_height="7mm" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentRight="true" 
     /> 

    <!-- send boxx 

    --> 


    <RelativeLayout 

     android:layout_marginTop="10dp" 
     android:visibility="invisible" 
     android:layout_centerVertical="true" 
     android:id="@+id/sendbox" 
     android:layout_centerHorizontal="true" 
     android:background="@drawable/sdboxx" 
     android:layout_width="280dp" 
     android:layout_height="330dp"> 

     <RelativeLayout 
      android:layout_marginTop="2mm" 
      android:id="@+id/headerportion" 
      android:layout_marginLeft="2mm" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="2mm" 
      > 
      <!-- android:shadowColor="#ffff" 
      android:shadowDx="0.5" 
      android:shadowDy="0.5" 
      android:shadowRadius="0.5"--> 
      <TextView 
       android:shadowColor="#ffff" 

       android:shadowRadius="1" 
       android:textSize="3mm" 
       android:layout_alignParentLeft="true" 
       android:textColor="#3951a3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/hide" 
       android:text="Hide" 
       /> 
      <TextView 

       android:shadowColor="#ffff" 
       android:shadowDx="1" 
       android:shadowDy="1" 
       android:shadowRadius="1" 
       android:textSize="3mm" 
       android:textStyle="bold" 
       android:layout_centerHorizontal="true" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#603913" 
       android:text="MANHATTAN" 
       /> 
      <TextView 
       android:shadowColor="#ffff" 

       android:shadowRadius="1" 
       android:textSize="3mm" 

       android:id="@+id/upper_search_text" 
       android:layout_alignParentRight="true" 
       android:textColor="#3951a3" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Search" 
       /> 
      <View 
       android:layout_below="@+id/upper_search_text" 
       android:id="@+id/line" 
       android:layout_width="fill_parent" 
       android:layout_height="1dp" 
       android:background="#603913" 

       /> 
      <TextView 
       android:shadowColor="#ffff" 
       android:shadowDx="1" 
       android:shadowDy="1" 
       android:shadowRadius="1" 
       android:id="@+id/bigtext" 
       android:layout_centerHorizontal="true" 
       android:layout_below="@+id/line" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textSize="3.5mm" 
       android:textColor="#603913" 
       android:text="Can I Park Here ?" 
       android:textStyle="bold" 
       /> 
      <LinearLayout 
       android:layout_marginLeft="2mm" 
       android:layout_marginRight="2mm" 
       android:orientation="vertical" 
       android:layout_below="@+id/bigtext" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 
       <LinearLayout 

        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"> 


        <EditText 
        android:id="@+id/house_number" 
         android:textAlignment="center" 
         android:textSize="10dp" 
         android:hint="Number" 
         android:inputType="number" 
         android:layout_weight=".75" 
         android:layout_width="12mm" 
         android:layout_height="3.5mm" 
         android:paddingLeft="10dp" 
         android:background="@drawable/edittext_bg"/> 
        <EditText 

         android:gravity="center_vertical|left" 
          android:maxLines="1" 
         android:id="@+id/street_full_name" 
         android:textSize="10dp" 
         android:hint="Street Full Name" 
         android:layout_weight=".75" 
         android:layout_marginLeft="1mm" 
         android:layout_width="30mm" 
         android:layout_height="3.5mm" 
         android:paddingLeft="10dp" 
         android:background="@drawable/edittext_bg"/> 

       </LinearLayout> 
       <LinearLayout 

        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"> 


        <TextView 

         android:shadowColor="#ffff" 
         android:shadowDx="1" 
         android:shadowDy="1" 
         android:shadowRadius="1" 
         android:layout_marginLeft="1mm" 
         android:text="Number" 
         android:layout_weight=".75" 
         android:layout_width="10mm" 
         android:layout_height="wrap_content" 
         android:textColor="#603913" 
         android:textSize="2mm" 
         android:textStyle="bold" 
         /> 
        <TextView 

         android:shadowColor="#ffff" 
         android:shadowDx="1" 
         android:shadowDy="1" 
         android:shadowRadius="1" 
         android:textSize="2mm" 
         android:textStyle="bold" 
         android:textColor="#603913" 
         android:layout_gravity="center_horizontal" 
         android:text="Street Full Name" 
         android:layout_weight=".75" 
         android:layout_marginLeft="7mm" 
         android:layout_width="28mm" 
         android:layout_height="wrap_content" 

         /> 

       </LinearLayout> 

       <TextView 

        android:paddingLeft="10dp" 
        android:gravity="center_vertical|left" 
        android:id="@+id/datepiker" 
        android:textSize="10dp" 
        android:hint=" 02/10/17 8:27PM" 
        android:background="@drawable/edittext_bg" 
        android:layout_width="match_parent" 
        android:layout_height="3.5mm" /> 
       <TextView 
        android:shadowColor="#ffff" 
        android:shadowDx="1" 
        android:shadowDy="1" 
        android:shadowRadius="1" 
        android:textSize="1mm" 
        android:textStyle="bold" 
        android:textColor="#603913" 
        android:layout_gravity="center_horizontal" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Date(MM/DD/YY) Hour(1-12)AM/PM" 

        /> 
       <ScrollView 
        android:layout_width="fill_parent" 
        android:layout_height="150dp" 
        android:background="@drawable/textview_bg" 
        android:fillViewport="true" 
        ><!-- <<<-&#45;&#45;&#45;&#45;&#45;&#45;added this line 

        >--> 
        <!-- android:paddingTop="10dp" 
        android:paddingLeft="10dp" 
        android:paddingRight="10dp" 
        android:paddingBottom="10dp"--> 

        <TextView 
         android:layout_gravity="fill" 
         android:paddingTop="8dp" 
         android:paddingLeft="8dp" 
         android:paddingRight="10dp" 
         android:paddingBottom="10dp" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:id="@+id/result" 
         android:textColor="#323232" 



         /> 
       </ScrollView> 

       /> 

       <TextView 
        android:layout_marginTop="1dp" 
        android:textSize="2mm" 
        android:shadowColor="#ffff" 
        android:shadowDx="1" 
        android:shadowDy="1" 
        android:shadowRadius="1" 
        android:textColor="#030000" 
        android:layout_gravity="center_horizontal" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="For more detail information," 
        android:textStyle="bold" 

        /> 
       <TextView 
        android:textSize="2mm" 
        android:shadowColor="#ffff" 
        android:shadowDx="1" 
        android:shadowDy="1" 
        android:shadowRadius="1" 
        android:textColor="#030000" 
        android:layout_gravity="center_horizontal" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Please refer to map symbols." 
        android:textStyle="bold" 
        android:layout_marginBottom="2dp" 
        /> 

      </LinearLayout> 
     </RelativeLayout> 



    </RelativeLayout> 




    <!--end send box--> 

<RelativeLayout 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:visibility="invisible" 
     android:id="@+id/starlayout" 
     android:background="#ffff" 
     android:layout_width="200dp" 
     android:layout_height="wrap_content"> 
     <TextView 
      android:textStyle="bold" 
      android:textSize="3mm" 
      android:id="@+id/topheader" 
      android:layout_alignParentTop="true" 
      android:layout_width="200dp" 
      android:layout_height="wrap_content" 
      android:text="Enter you Location name" 
      /> 
<EditText 

    android:id="@+id/loc_name" 
    android:layout_below="@+id/topheader" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 
     <LinearLayout 

      android:layout_alignParentRight="true" 
      android:layout_below="@+id/loc_name" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 


      <TextView 
android:layout_marginTop="3dp" 
       android:text="Save" 
       android:textColor="#c9b8a6" 
       android:layout_below="@+id/loc_name" 
       android:id="@+id/saveloc" 
       android:layout_width="50dp" 
       android:textSize="3mm" 

       android:layout_height="40dp" /> 
      <TextView 
       android:layout_marginTop="3dp" 
       android:textColor="#c9b8a6" 
       android:text="Cancl" 

       android:layout_width="50dp" 
       android:layout_height="40dp" 
       android:id="@+id/canclebtn" 
       android:textSize="3mm" 
       /> 



     </LinearLayout> 


    </RelativeLayout> 




    <ImageButton 
     android:id="@+id/gerag" 
     android:layout_marginBottom="20dp" 
     android:layout_marginLeft="20dp" 
     android:layout_width="7mm" 
     android:layout_height="7mm" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:scaleType="centerInside" 
     android:background="@null" 
     android:src="@drawable/garage_btn" 
     /> 

</RelativeLayout> 

**我的MainActivity XML代碼**

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 

    tools:context="com.example.rehankhan.parkken_app.MainActivity"> 

    <android.support.design.widget.TabLayout 
     android:id="@+id/tab_layout" 
     android:layout_width="match_parent" 
     android:layout_height="10mm" 
     tabTextAppearance="@style/TabLayoutStyle" 

     android:background="#f4f8f9" 
     android:layout_alignParentBottom="true" 
     > 
    </android.support.design.widget.TabLayout> 
    <!-- <android.support.v4.view.ViewPager 
     android:id="@+id/main_tab_content" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_alignParentTop="true" 
     android:layout_above="@id/tab_layout" 
     > 
    </android.support.v4.view.ViewPager>--> 
    <com.example.rehankhan.parkken_app.Model.NonSwipeableViewPager 
     android:id="@+id/main_tab_content" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_alignParentTop="true" 
     android:layout_above="@id/tab_layout" 
     > 
    </com.example.rehankhan.parkken_app.Model.NonSwipeableViewPager> 


</RelativeLayout> 
+0

是哪裏的家,地圖和所有這些按鈕的底視圖,這也是你的看法? – sumit

+0

我的主要活動中的標籤佈局。並且Map視圖是一個片段。我在顯示地圖片段中發送框的視圖時面臨問題。 –

+0

分享您的MapFragment的xml,您想要顯示您的發送框視圖 – sumit

回答

0

這裏試試這個:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 

    tools:context="com.example.rehankhan.parkken_app.MainActivity"> 



    <android.support.design.widget.TabLayout 
     android:id="@+id/tab_layout" 
     android:layout_width="match_parent" 
     android:layout_height="10mm" 
     tabTextAppearance="@style/TabLayoutStyle" 

     android:background="#f4f8f9" 
     android:layout_alignParentBottom="true" 
     > 
    </android.support.design.widget.TabLayout> 

//code for Sendbox now it'll be always on top on tablayout 
    <include layout="@layout/sandbox" 
       android:id="@+id/sandBoxlayout"/> 

希望它可以幫助!

+0

感謝峯會。爲了給我你的寶貴時間。但請你能再次看到我的目標圖像。我究竟想要什麼 –

+0

如果我錯了,請更正我的問題你希望你的沙盒佈局在你的Mapview的頂部,但是使用當前的佈局。切在底部。你想讓你的發送箱在這些底部按鈕之上? – sumit

+0

不,你有點不對。我希望我的發送箱佈局超過tablayout.that是在bottom.please再次看到我的圖片 –

0

您可以使用滾動型作爲父視圖。

+0

感謝您的迴應。標籤佈局在我的主要activity.And地圖視圖是一個片段。我面臨的問題,同時顯示地圖片段發送框的視圖..請參閱實際圖片我需要 –

0

您可以嘗試使用Framelayout。您可以輕鬆地在Framelayout中重疊兩個佈局。

由於Android開發者網站:layout_gravity屬性:

您可以將多個孩子的FrameLayout內使用了Android重力分配到每個孩子,添加到的FrameLayout和控制他們的位置。 子視圖以堆疊形式繪製,最近添加的子項位於頂部。 FrameLayout的大小是其最大子項(加上填充)的大小,可見與否(如果FrameLayout的父級允許)。