关于android的不同机型界面布局问题 现在我做的一个程序基本完成了但是在很多不同的机器的分辨率下面。有的布局却非常不好(主要是控件的大小和位子)。我现在是不是要做2套或者3套布局。还是在界面进入的时候直接调整控件大小和位置啊。有什么方法比较好用的,小弟希望各位指点。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这种问题肯定是有的,尤其是在真机上,我用G7 480*800和华为的320*480测试。<LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_height="fill_parent" android:background="@drawable/dicetwo" android:gravity="bottom"> <Button android:id="@+id/Button_welcome01" android:text="PLAY" android:layout_height="65dip" android:textSize="25sp" android:layout_width="250dip"></Button> <Button android:text="MENU" android:id="@+id/Button_welcome02" android:textSize="25sp" android:layout_height="65dip" android:layout_marginTop="20dip" android:layout_width="250dip"></Button> <Button android:text="OPTIONS" android:id="@+id/Button_welcome03" android:layout_height="65dip" android:layout_marginBottom="20dip" android:layout_marginTop="20dip" android:layout_width="250dip" android:textSize="25sp"></Button> <Button android:id="@+id/Button_welcome04" android:text="HELP" android:layout_height="65dip" android:layout_width="250dip" android:layout_marginBottom="20dip" android:textSize="25sp"></Button> </LinearLayout>就这布局上面的按钮在g7上面的效果一般般大,可是到了C8600上面都快占满屏幕了恩。这怎么办啊 苹果系统好还是google的安卓好? Android手机屏幕大小不一,有480×320, 640×360, 800×480.怎样才能让App自动适应不同的屏幕呢?其实很简单,只需要在res目录下创建不同的layout文件夹,比如layout-640×360,layout-800×480,所有的layout文件在编译之后都会写入R.java里,而系统会根据屏幕的大小自己选择合适的layout进行使用。这个我试了怎么不行哇。一建就出错。。哎。悲剧了 用<RelativeLayout>布局,或用<TablableLayout>布局 这个我也不知道有什么好方法,每次我都是获取屏幕的大小,然后通过屏幕大小设置不同layout,不知道这样方法可取不,下面是设置的代码: if (height <= 427) { //240*320 屏幕高度一般为 427 setContentView(R.layout.mainsmall); } else if (height > 427 && height <= 480) { //320*480 屏幕高度一般为 480 setContentView(R.layout.main1); } else { setContentView(R.layout.main1big); } Android—为什么从麦克风中采集的数据具有很大的噪音? 新手问题 GridView做的菜单栏 如何实现在多个Activity跳转,菜单栏一直保持在底部 Android Camera 明细 安卓可以用java模拟器吗? 本人正在学习android,请教Gallery相册问题 新手求解安装问题 ZTE MF626 3G上网卡的脚本 webview中的点击连接 关于Andorid新进程中的binder实体 求答案 android布局问题 请问如何获取imageButton的背景图片的资源ID并且打印出来?
android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_height="fill_parent"
android:background="@drawable/dicetwo" android:gravity="bottom">
<Button android:id="@+id/Button_welcome01" android:text="PLAY"
android:layout_height="65dip" android:textSize="25sp"
android:layout_width="250dip"></Button>
<Button android:text="MENU" android:id="@+id/Button_welcome02"
android:textSize="25sp" android:layout_height="65dip"
android:layout_marginTop="20dip" android:layout_width="250dip"></Button>
<Button android:text="OPTIONS" android:id="@+id/Button_welcome03"
android:layout_height="65dip" android:layout_marginBottom="20dip"
android:layout_marginTop="20dip" android:layout_width="250dip"
android:textSize="25sp"></Button>
<Button android:id="@+id/Button_welcome04" android:text="HELP"
android:layout_height="65dip" android:layout_width="250dip"
android:layout_marginBottom="20dip" android:textSize="25sp"></Button>
</LinearLayout>就这布局上面的按钮在g7上面的效果一般般大,可是到了C8600上面都快占满屏幕了
恩。这怎么办啊
其实很简单,只需要在res目录下创建不同的layout文件夹,比如layout-640×360,layout-800×480,所有的layout文件在编译之后都会写入R.java里,而系统会根据屏幕的大小自己选择合适的layout进行使用。这个我试了怎么不行哇。一建就出错。。哎。悲剧了
if (height <= 427) { //240*320 屏幕高度一般为 427
setContentView(R.layout.mainsmall);
} else if (height > 427 && height <= 480) { //320*480 屏幕高度一般为 480
setContentView(R.layout.main1);
} else {
setContentView(R.layout.main1big);
}