最近在做android的layout,但是发现用了dip的单位后,在不同屏幕下还是有差矣,请问怎么办

highwaylau 2011-10-12 11:44:24
在320*480 的屏幕是这样子的 http://hi.csdn.net/space-9942144-do-album-picid-943888-goto-down.html
在240*320的屏幕是这样子的 http://hi.csdn.net/space-9942144-do-album-picid-943887-goto-up.htmlt
上面两个是图片链接,发现一个问题就是两个的edittext没有对好,在240*320就失准了,编辑框我是采用先p好图
,然后自己把编辑框控件对应上P好的图的编辑框,然后设为透明。
xml文件如下:

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

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TVB体"
android:textSize="20sp"
android:textColor="#996600"
android:layout_gravity="center"
android:layout_marginTop="11dp"
android:background="#00ffffff">
</TextView>


<EditText
android:layout_width="153dp"
android:layout_height="40dp"
android:layout_marginLeft="142dp"
android:layout_marginTop="4dp"
android:id="@+id/tvb_input1"
android:textColor="#996600"
android:background="#00ffffff"
/>


<EditText

android:layout_width="153dp"
android:layout_height="40dp"
android:layout_marginLeft="142dp"
android:layout_marginTop="12dp"
android:id="@+id/tvb_input2"
android:textColor="#996600"
android:background="#00ffffff"
/>


<EditText
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_marginLeft="145dp"
android:layout_marginTop="12dp"
android:textColor="#996600"
android:id="@+id/tvb_input3"
android:background="#00ffffff"
/>



<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_marginTop="20dp"
android:layout_height="wrap_content"
>
<Button
android:layout_width="120dp"
android:layout_height="40dp"

android:layout_marginLeft="42dp"
android:background="#00ffffff"
android:id="@+id/tvb_submit"
/>
<Button
android:layout_width="120dp"
android:layout_height="40dp"

android:layout_marginLeft="8dp"
android:id="@+id/tvb_share"
android:background="#00ffffff"
/>


</LinearLayout>
<EditText
android:layout_width="250dp"
android:layout_height="160dp"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp"
android:id="@+id/tvb_show"
android:textColor="#996600"
android:background="#00ffffff"
/>
</LinearLayout>
求各位大牛帮帮忙

...全文
279 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
highwaylau 2011-10-15
  • 打赏
  • 举报
回复
继续自己顶啊,各位好心人帮帮忙啊、
wenzheng38 2011-10-15
  • 打赏
  • 举报
回复
用相对布局RelativeLayout
highwaylau 2011-10-15
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 wenzheng38 的回复:]

用相对布局RelativeLayout
[/Quote]针对我这个例子该怎么改呢
fmworld 2011-10-13
  • 打赏
  • 举报
回复
屏幕自适应。。。, 这个就看布局合理不,想办法将自己的布局不值的更好点,比如将多种布局混用,哪些部件在一个布局里面,还有手动设置部件大小岁分辨率的变化而变化的,就那那个成比例变大缩小的。当然,最简单,但是很繁琐的就是自己做多套xml。。。
highwaylau 2011-10-12
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 lovexjyong 的回复:]

可以自己写多分辨率样式啊,这样就可以根据不同的分辨率进行调整了!!
[/Quote]它有好多种分辨率啊,有320*480,240*320,240*432,800*480等等,要写多少样式啊..
a-white-lie 2011-10-12
  • 打赏
  • 举报
回复
可以自己写多分辨率样式啊,这样就可以根据不同的分辨率进行调整了!!
highwaylau 2011-10-12
  • 打赏
  • 举报
回复
自己顶,各位帮帮忙啊

80,471

社区成员

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

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