屏幕适配

来源:互联网 发布:php数据库教程 编辑:程序博客网 时间:2024/06/14 10:42

一 效果图

二 主要代码

320x240

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent" >    <TextView        android:id="@+id/textView1"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/name" />    <Button        android:id="@+id/button1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_alignParentLeft="true"        android:layout_below="@+id/textView1"        android:layout_marginTop="85dp"        android:text="@string/button" />    <EditText        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_alignParentLeft="true"        android:layout_below="@+id/textView1"        android:layout_marginTop="22dp"        android:ems="10" /></RelativeLayout>
480x320

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"     ><LinearLayout    android:layout_width="fill_parent"    android:layout_height="match_parent"    android:orientation="horizontal"    >    <Button        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:text="@string/button" />    <TextView        android:layout_width="80dp"        android:layout_height="wrap_content"        android:text="@string/name" />    <EditText          android:layout_width="fill_parent"        android:layout_height="wrap_content"        /></LinearLayout></RelativeLayout>



0 0
原创粉丝点击