android请教,求好心人解答

Mr_JJ_Lian 2012-03-23 05:12:23
我的android UI在分辨率为480x800的手机上布局正确,但是到了400x480就乱了!请为用相对布局可以解决这个问题吗??但是用相对布局又不能很好精确到我想要的位置!请问大家有什么好的办法吗????
...全文
80 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Mr_JJ_Lian 2012-03-23
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 leer168 的回复:]

2种方案
1.一种布局适应不同的分辨率
2.为不同的分辨率建立不同的布局
看哪种适合你的需求
[/Quote]
采用第一种就是要写成相对布局,但是相对布局又很难写出精确的大小和位置!
leer168 2012-03-23
  • 打赏
  • 举报
回复
2种方案
1.一种布局适应不同的分辨率
2.为不同的分辨率建立不同的布局
看哪种适合你的需求
Mr_JJ_Lian 2012-03-23
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 freshui 的回复:]

设计几套UI,分别加载
[/Quote]
只有这种办法吗??
Mr_JJ_Lian 2012-03-23
  • 打赏
  • 举报
回复
只有这种办法吗??
freshui 2012-03-23
  • 打赏
  • 举报
回复
设计几套UI,分别加载
Mr_JJ_Lian 2012-03-23
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget41"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background" >

<!--
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dip"
android:layout_marginTop="15dip"
>

<LinearLayout
android:id="@+id/ll_bt_data_config"
android:layout_width="70dip"
android:layout_height="40dip"
android:layout_x="100dip"
android:layout_y="20dip"
android:background="#8B8378" />

<LinearLayout
android:id="@+id/ll_bt_data_config1"
android:layout_width="70dip"
android:layout_height="40dip"
android:layout_x="30sp"
android:layout_y="20sp"
android:background="#8B8378" />

<LinearLayout
android:id="@+id/ll_bt_data_config2"
android:layout_width="120px"
android:layout_height="62px"
android:layout_x="210dp"
android:layout_y="20dp"
android:background="#8B8378" />
</RelativeLayout>
-->

<RelativeLayout
android:id="@+id/widget40"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dip" >

<LinearLayout
android:id="@+id/ll_bt_data_config"
android:layout_width="77dip"
android:layout_height="40dip"
android:layout_marginLeft="25dip"
android:background="#8B8378"
android:orientation="vertical" >
</LinearLayout>

<LinearLayout
android:id="@+id/ll_bt_data_config1"
android:layout_width="77dip"
android:layout_height="40dip"
android:layout_marginLeft="120dip"
android:background="#8B8378"
android:orientation="vertical" >
</LinearLayout>

<LinearLayout
android:id="@+id/ll_bt_data_config2"
android:layout_width="77dip"
android:layout_height="40dip"
android:layout_marginLeft="215dip"
android:background="#8B8378"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
<!--
<AbsoluteLayout
android:id="@+id/widget171"
android:layout_width="316px"
android:layout_height="42px"
android:layout_x="2dp"
android:layout_y="16dp" >

<zsc.edu.lian.ImageButton1
android:id="@+id/button01"
android:layout_width="62px"
android:layout_height="30px"
android:layout_x="22dp"
android:layout_y="5dp"
android:src="@drawable/button"
android:textColor="#000000" />

<zsc.edu.lian.ImageButton1
android:id="@+id/button02"
android:layout_width="62px"
android:layout_height="30px"
android:layout_x="115dp"
android:layout_y="5dp"
android:background="#FFFFFF"
android:src="@drawable/button"
android:text="Button" />

<zsc.edu.lian.ImageButton1
android:id="@+id/button03"
android:layout_width="62px"
android:layout_height="30px"
android:layout_x="211dp"
android:layout_y="5dp"
android:src="@drawable/button"
android:text="Button" />

</AbsoluteLayout>
-->

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="75dip" >

<TextView
android:id="@+id/textview01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg3" />

<TextView
android:id="@+id/textview11"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="130dip"
android:layout_marginTop="25dip"
android:text="@string/app_name"
android:textColor="#FFFFFF"
android:textSize="13sp" />
</RelativeLayout>

<RelativeLayout
android:id="@+id/widget178"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="128dip" >

<EditText
android:id="@+id/edittext1"
android:layout_width="220dip"
android:layout_height="30dip"
android:layout_marginLeft="17dip"
android:layout_marginTop="10dip"
android:background="@drawable/myeditview"
android:textColor="#000000"
android:textSize="15sp" />

<Button
android:id="@+id/button04"
android:layout_width="55dip"
android:layout_height="35dip"
android:layout_marginLeft="235dip"
android:layout_marginTop="8dip"
android:background="@drawable/button_new"
android:text="@string/sousuo_name"
android:textColor="@color/white"
android:textSize="10dp" />
</RelativeLayout>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="13dip"
android:layout_marginTop="167dip" >

<ListView
android:id="@+id/listView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip" />

</RelativeLayout>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="442dip" >

<TextView
android:id="@+id/textviewball"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="109dip"
android:background="@drawable/ball1" />
<TextView
android:id="@+id/textviewball1"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="120dip"
android:background="@drawable/ball2" />
<TextView
android:id="@+id/textviewball2"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="131dip"
android:background="@drawable/ball2" />

<TextView
android:id="@+id/textviewball3"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="142dip"
android:background="@drawable/ball2" />
<TextView
android:id="@+id/textviewball4"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="153dip"
android:background="@drawable/ball2" />
<TextView
android:id="@+id/textviewball5"
android:layout_width="10dip"
android:layout_height="10dip"
android:layout_marginLeft="164dip"
android:background="@drawable/ball2" />


</RelativeLayout>

</RelativeLayout>

这是我的布局,,这个布局一到不同分辨率的手机,呈现的效果就不同了!
小笨熊 2012-03-23
  • 打赏
  • 举报
回复
呵呵,兼容性问题。。。不管用啥布局都可以,那你怎么设置了

80,493

社区成员

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

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