我有一个xml文件如下.
<?xml version="1.0" enCoding="utf-8"?><ScrollVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="match_parent" androID:background="@drawable/imagesand" androID:layout_height="match_parent" ><linearLayout androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:orIEntation="vertical" androID:paddingleft="10dp" androID:paddingRight="10dp" > <TextVIEw androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:text="Collaboration Set Up :" androID:textSize="20dp" /> <EditText androID:ID="@+ID/projectname" androID:layout_wIDth="match_parent" androID:layout_height="36dp" androID:hint="Group name" androID:paddingleft="10dp" androID:background="@drawable/button" androID:ems="10" > </EditText> <TextVIEw androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:text="Data To Collect :" androID:textSize="20dp" /> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal" > <CheckBox androID:ID="@+ID/fnamechk" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:checked="true" androID:enabled="false" androID:textSize="13dp" androID:text=" First name" /> <CheckBox androID:ID="@+ID/lnamechk" androID:textSize="13dp" androID:layout_wIDth="wrap_content" androID:checked="true" androID:enabled="false" androID:layout_height="wrap_content" androID:text="Last name" /> <CheckBox androID:ID="@+ID/personalemailchk" androID:layout_wIDth="wrap_content" androID:checked="true" androID:enabled="false" androID:layout_height="wrap_content" androID:text="Personal Email" androID:textSize="13dp" /> </linearLayout> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal" > <CheckBox androID:ID="@+ID/workphonechk" androID:textSize="13dp" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Work Ph." /> <CheckBox androID:ID="@+ID/companychk" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Company" androID:textSize="13dp" /> <CheckBox androID:ID="@+ID/Workemailchk" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Work Email" androID:textSize="13dp" /> </linearLayout> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal" > <CheckBox androID:ID="@+ID/cellchk" androID:layout_wIDth="wrap_content" androID:textSize="13dp" androID:layout_height="wrap_content" androID:text="MobNo." /> </linearLayout> <TextVIEw androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:text="Data Visible to User:" androID:textSize="20dp" /> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal" > <CheckBox androID:ID="@+ID/fname2" androID:textSize="13dp" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:enabled="false" androID:checked="true" androID:text="First name" /> <CheckBox androID:ID="@+ID/lname2" androID:enabled="false" androID:checked="true" androID:textSize="13dp" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Last name" /> <CheckBox androID:ID="@+ID/personalemail2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:enabled="false" androID:checked="true" androID:text="Personal Email" androID:textSize="13dp" /> </linearLayout> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal" androID:paddingBottom="10dp" > <CheckBox androID:ID="@+ID/workphone2" androID:textSize="13dp" androID:enabled="false" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Work Ph." /> <CheckBox androID:ID="@+ID/Comoany2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:enabled="false" androID:text="Company" androID:textSize="13dp" /> <CheckBox androID:ID="@+ID/workemail2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:enabled="false" androID:text="Work Email" androID:textSize="13dp" /> </linearLayout> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:orIEntation="horizontal" > <CheckBox androID:ID="@+ID/cell2" androID:textSize="13dp" androID:enabled="false" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:text="Mob.No" /> </linearLayout> <linearLayout androID:orIEntation="horizontal" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content"> <RadioGroup androID:ID="@+ID/radioGroup1" androID:orIEntation="horizontal" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" > <Radiobutton androID:ID="@+ID/available" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:textSize="13dp" androID:text="Available" /> <Radiobutton androID:ID="@+ID/none" androID:textSize="13dp" androID:layout_gravity="center_horizontal" androID:layout_wIDth="wrap_content" androID:layout_marginleft="50dp" androID:layout_height="wrap_content" androID:text="None" /> </RadioGroup> </linearLayout> <linearLayout androID:orIEntation="horizontal" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content"> <RadioGroup androID:ID="@+ID/radioGroup2" androID:orIEntation="horizontal" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" > <Radiobutton androID:ID="@+ID/Private" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:textSize="13dp" androID:text="Private" /> <Radiobutton androID:ID="@+ID/Public" androID:layout_marginleft="65dp" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:textSize="13dp" androID:text="Public" /> </RadioGroup> </linearLayout> <button androID:ID="@+ID/generate" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_gravity="center" androID:background="@drawable/login" androID:text="Generate" /></linearLayout></ScrollVIEw>
当我在较小的设备中打开它时,它看起来像这样.我已经实现了滚动视图.
当我在平板电脑中打开时,它就像这样.
正如您所看到的,在标签中浪费了更大的空间,那么我可以利用可用空间并根据屏幕大小将复选框分布在屏幕上吗?
解决方法:
您必须为此使用配置限定符,您可以参考以下帖子:
1.Post A
2.Post B
基本上你的项目应该是这样的:
或者,您还可以通过维度控制布局,例如:
<button androID:wIDth= "@dimen/somewIDth"/>
将此维数声明为多个值,如下所示:
总结以上是内存溢出为你收集整理的如何调整多屏幕android的用户界面?全部内容,希望文章能够帮你解决如何调整多屏幕android的用户界面?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)