用横板编码怎么显示不一样

用横板编码怎么显示不一样

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

   <LinearLayout
       android:layout_width="0dp"
       android:layout_weight="1"
       android:layout_height="match_parent"
       android:orientation="vertical">
       <TextView
           android:layout_width="match_parent"
           android:layout_height="50dp"
           android:gravity="center"
           android:textColor="@android:color/black"
           android:textSize="22sp"
           android:textStyle="bold"
           android:text="房间"
           />

       <androidx.recyclerview.widget.RecyclerView
           android:id="@+id/recyclerView"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           />


   </LinearLayout>

   <LinearLayout
       android:layout_width="0dp"
       android:layout_height="match_parent"
       android:layout_weight="6"
       android:orientation="vertical"
       >
       <TextView
           android:layout_width="match_parent"
           android:layout_height="50dp"
           android:gravity="center"
           android:textColor="@android:color/black"
           android:textSize="22sp"
           android:textStyle="bold"
           android:text="房间"
           />
       <FrameLayout
           android:id="@+id/container"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           >

           <Button
               android:id="@+id/back"
               android:layout_width="60dp"
               android:layout_height="60dp"
               android:layout_gravity="bottom|right"
               android:layout_marginRight="10dp"
               android:layout_marginLeft="10dp"
               android:text="离开" />

       </FrameLayout>



   </LinearLayout>

</LinearLayout>

这个是activity


下面是fragment

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
   android:orientation="vertical"
   tools:context=".fragment.HeatingFragment">

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:gravity="center"
       android:layout_weight="2">


       <TextView
           android:layout_width="70dp"
           android:layout_height="match_parent"
           android:text="温度"
           android:gravity="center"
           android:textSize="26sp"
           />
       <TextView
           android:layout_width="40dp"
           android:layout_height="match_parent"
           android:gravity="center"
           android:textSize="30sp"
           />
   </LinearLayout>

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="1">


   </LinearLayout>

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="2"

       >
       <TextView
           android:layout_width="40dp"
           android:layout_height="match_parent"
           android:text="开关"
           android:textSize="14sp"
           android:gravity="center"
           android:layout_marginLeft="40dp"
           />
       <RadioGroup
           android:layout_width="140dp"
           android:layout_height="match_parent"
           android:orientation="horizontal"
           >
           <RadioButton
               android:id="@+id/on"
               android:text="ON"
               style="@style/frag_rg_btn_bg" />

           <RadioButton
               android:id="@+id/off"
               android:text="OFF"
               style="@style/frag_rg_btn_bg" />



       </RadioGroup>


   </LinearLayout>
   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="2"

       >
       <TextView
           android:layout_width="40dp"
           android:layout_height="match_parent"
           android:text="风速"
           android:textSize="14sp"
           android:gravity="center"
           android:layout_marginLeft="40dp"
           />
       <RadioGroup
           android:layout_width="280dp"
           android:layout_height="match_parent"
           android:orientation="horizontal"
           >
           <RadioButton
               android:id="@+id/high"
               android:text="高速"
               style="@style/frag_rg_btn_bg" />

           <RadioButton
               android:id="@+id/second"
               android:text="中速"
               style="@style/frag_rg_btn_bg" />
           <RadioButton
               android:id="@+id/low"
               android:text="低速"
               style="@style/frag_rg_btn_bg" />

           <RadioButton
               android:id="@+id/auto"
               android:text="自动"
               style="@style/frag_rg_btn_bg" />
       </RadioGroup>
   </LinearLayout>
   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="2">
       <TextView
           android:layout_width="40dp"
           android:layout_height="match_parent"
           android:text="模式"
           android:textSize="14sp"
           android:gravity="center"
           android:layout_marginLeft="40dp"
           />
       <RadioGroup
           android:layout_width="360dp"
           android:layout_height="match_parent"
           android:orientation="horizontal"
           >
           <RadioButton
               android:id="@+id/cold"
               android:text="制冷"
               style="@style/frag_rg_btn_bg" />

           <RadioButton
               android:id="@+id/hot"
               android:text="制热"
               style="@style/frag_rg_btn_bg" />
           <RadioButton
               android:id="@+id/give"
               android:text="送风"
               style="@style/frag_rg_btn_bg" />

           <RadioButton
               android:id="@+id/one"
               android:text="一体"
               style="@style/frag_rg_btn_bg" />
           <RadioButton
               android:id="@+id/heating"
               android:text="擦暖"
               style="@style/frag_rg_btn_bg" />
       </RadioGroup>

   </LinearLayout>





   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="2">

       <TextView
           android:layout_width="68dp"
           android:layout_height="match_parent"
           android:text="温度设置"
           android:textSize="14sp"
           android:gravity="center"
           android:layout_marginLeft="12dp"
           />
       <LinearLayout
           android:layout_width="210dp"
           android:layout_height="match_parent"
           android:orientation="horizontal"
           >
           <Button
               android:id="@+id/reduce"
               android:text="-"
               style="@style/frag_rg_btn_bg" />
           <TextView
               android:id="@+id/tempShow"
               android:text="℃℃℃"
               style="@style/frag_rg_btn_bg" />
           <Button
               android:id="@+id/add"
               android:text="+"
               style="@style/frag_rg_btn_bg" />

       </LinearLayout>


   </LinearLayout>
   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="2"></LinearLayout>

</LinearLayout>

左边是控制右边是切换。

http://img1.sycdn.imooc.com//climg/60644b0709c717b904720280.jpg

http://img1.sycdn.imooc.com//climg/60644b0709795b4904530265.jpg

http://img1.sycdn.imooc.com//climg/60644b070819e64908001600.jpg

右边被吃了一大块空白,如果的框在大点的话,就显示不出来了

请问怎么样才能让这个fragment在这个控件里面全部显示出来,

竖版的话确实全部显示出来的。应为左右固定上下可以移动

我这个平板固定横板无法竖版。老师我这里请教下


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕雪 2021-03-31 18:44:09
同学,你好!这种情况你就要定两套xml了,layout-land 文件夹下放横屏的xml。祝:学习愉快!
  • 提问者 weixin_慕虎4366137 #1

    我是放了一套在里面,但是右边fragment还是被吃掉了空白

    2021-03-31 21:02:40
  • 提问者 weixin_慕虎4366137 #2

    平板的边框是不是也会吃掉屏幕的尺寸

    2021-03-31 21:25:19
  • 不行的,放在一套里不好控制。因为你的平板与手机尺寸宽高,差很远呢

    2021-04-01 11:30:43
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师