关于android布局中的横竖屏切换的问题

fyl137 2011-01-26 07:38:44
各位大虾,你们好
想请教你们一个问题,我的xml布局在模拟器中运行的时候出现一个问题,就是切换为横屏的时候,处在竖屏下方的控件就无法显示了!这是什么问题,该怎么解决呢?谢谢啦~~
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/widget54"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
style="@style/Theme.home"
xmlns:android="http://schemas.android.com/apk/res/android"
>

<TextView
android:id="@+id/widget30"
android:text="welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="50sp"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_marginTop="50px"
>
</TextView>

<Button
android:id="@+id/widget31"
android:layout_width="175px"
android:layout_height="wrap_content"
android:text="data"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_below="@id/widget30"
android:layout_marginTop="40px"
>
</Button>
<Button
android:id="@+id/widget32"
android:layout_width="175px"
android:layout_height="wrap_content"
android:text="data"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_below="@id/widget31"
android:layout_marginTop="20px"
>
</Button>
<Button
android:id="@+id/widget33"
android:layout_width="175px"
android:layout_height="wrap_content"
android:text="@string/exit"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_below="@id/widget32"
android:layout_marginTop="20px"
>
</Button>
<TextView
android:id="@+id/widget34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="company"
android:textColor="#ff666666"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
>
</TextView>
</RelativeLayout>

...全文
919 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
CUG87525842 2011-02-14
  • 打赏
  • 举报
回复
横竖屏幕大小不一样,按照你定义的大小肯定看不见了。你最好再定义一个针对竖屏的xml,放到layout-land文件夹下面。
freshui 2011-02-11
  • 打赏
  • 举报
回复
用的是绝对坐标,而且单位是px的,这些都不是好习惯。
lihongchuan 2011-02-11
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 prince58 的回复:]

重新写一个同名的横屏的布局文件 放在layout-land下面。
[/Quote]

正解
hohaiuhsx 2011-01-30
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 prince58 的回复:]
重新写一个同名的横屏的布局文件 放在layout-land下面。
[/Quote]

正解
ameyume 2011-01-30
  • 打赏
  • 举报
回复
android:layout_marginTop="50px"
太大太占空间了,在横屏时尤其明显,本来横屏的高度就有限。
hai675264783 2011-01-30
  • 打赏
  • 举报
回复
为是么要把width都定死了,用比重属性吧,按比例来划分就不会这样了
work_acc 2011-01-27
  • 打赏
  • 举报
回复
使用scrollview吧
ArashmenZhu 2011-01-27
  • 打赏
  • 举报
回复
你的Androidmanifest.xml
使用该Activity的LanchMode,改成默认的standard模式
Berry_tian 2011-01-27
  • 打赏
  • 举报
回复
你加一个ScrollView滚动条不行吗?
fyl137 2011-01-27
  • 打赏
  • 举报
回复
是不是用的hard code太多了呢,可是我只能想到layout_weight方法啊,这个方法又只能用在linearlayout中
prince58 2011-01-27
  • 打赏
  • 举报
回复
重新写一个同名的横屏的布局文件 放在layout-land下面。

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧