Android 活动的布局差异

Android 活动的布局差异,android,responsive-design,Android,Responsive Design,我创建了活动,但两者都有不同的外观 Nexsus 10的图像 320 x 480的图像 在第一张图片中,它在底部显示了太多的空间。我怎样才能解决这个问题?我该如何使其响应 提前谢谢您结账 基本上: 将布局的不同版本保存在示例中的文件夹中 layout-hdpi layout-mdpi layout-other_selector_that_you_want etc检查 基本上: 将布局的不同版本保存在示例中的文件夹中 layout-hdpi layout-mdpi layou

我创建了活动,但两者都有不同的外观

Nexsus 10的图像

320 x 480的图像

在第一张图片中,它在底部显示了太多的空间。我怎样才能解决这个问题?我该如何使其响应

提前谢谢您

结账

基本上:

将布局的不同版本保存在示例中的文件夹中

 layout-hdpi
 layout-mdpi 
 layout-other_selector_that_you_want
etc检查

基本上:

将布局的不同版本保存在示例中的文件夹中

 layout-hdpi
 layout-mdpi 
 layout-other_selector_that_you_want
etc检查

基本上:

将布局的不同版本保存在示例中的文件夹中

 layout-hdpi
 layout-mdpi 
 layout-other_selector_that_you_want
etc检查

基本上:

将布局的不同版本保存在示例中的文件夹中

 layout-hdpi
 layout-mdpi 
 layout-other_selector_that_you_want

etc

您需要为手机和平板电脑设备创建登录页面,并相应调整布局

最简单的情况是智能手机的布局存储在
res/layout/login.xml
中,平板电脑的布局存储在
res/layout large/login.xml
把这些布局分开,试着在平板电脑的版面上添加一些填充物,并在屏幕中间排列布局,我相信它会看起来更好。


(如果您没有
res
目录中的文件夹
layout large
,则需要手动创建该文件夹)

您需要为手机和平板电脑设备创建登录页面,并相应调整布局

最简单的情况是智能手机的布局存储在
res/layout/login.xml
中,平板电脑的布局存储在
res/layout large/login.xml
把这些布局分开,试着在平板电脑的版面上添加一些填充物,并在屏幕中间排列布局,我相信它会看起来更好。


(如果您没有
res
目录中的文件夹
layout large
,则需要手动创建该文件夹)

您需要为手机和平板电脑设备创建登录页面,并相应调整布局

最简单的情况是智能手机的布局存储在
res/layout/login.xml
中,平板电脑的布局存储在
res/layout large/login.xml
把这些布局分开,试着在平板电脑的版面上添加一些填充物,并在屏幕中间排列布局,我相信它会看起来更好。


(如果您没有
res
目录中的文件夹
layout large
,则需要手动创建该文件夹)

您需要为手机和平板电脑设备创建登录页面,并相应调整布局

最简单的情况是智能手机的布局存储在
res/layout/login.xml
中,平板电脑的布局存储在
res/layout large/login.xml
把这些布局分开,试着在平板电脑的版面上添加一些填充物,并在屏幕中间排列布局,我相信它会看起来更好。


(如果您没有
res
目录中的文件夹
layout large
,您将需要手动创建它)

好吧,看来您正在包装高度。如果你在谈论比率,你应该在布局中使用重量,而不是包装高度

演示代码

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"
    android:gravity="center"/>
<ImageView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
   android:src="@drawable/ic_launcher"
    android:gravity="center"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter User Name"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter Password"/>
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
    android:text="Large Text"
    android:gravity="center_vertical"/>
<Button android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"/>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:orientation="horizontal">
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Register"/>
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Help"/>
</LinearLayout>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
</LinearLayout>


看来你的身高太高了。如果你在谈论比率,你应该在布局中使用重量,而不是包装高度

演示代码

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"
    android:gravity="center"/>
<ImageView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
   android:src="@drawable/ic_launcher"
    android:gravity="center"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter User Name"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter Password"/>
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
    android:text="Large Text"
    android:gravity="center_vertical"/>
<Button android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"/>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:orientation="horizontal">
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Register"/>
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Help"/>
</LinearLayout>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
</LinearLayout>


看来你的身高太高了。如果你在谈论比率,你应该在布局中使用重量,而不是包装高度

演示代码

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"
    android:gravity="center"/>
<ImageView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
   android:src="@drawable/ic_launcher"
    android:gravity="center"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter User Name"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter Password"/>
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
    android:text="Large Text"
    android:gravity="center_vertical"/>
<Button android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"/>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:orientation="horizontal">
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Register"/>
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Help"/>
</LinearLayout>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
</LinearLayout>


看来你的身高太高了。如果你在谈论比率,你应该在布局中使用重量,而不是包装高度

演示代码

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"
    android:gravity="center"/>
<ImageView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
   android:src="@drawable/ic_launcher"
    android:gravity="center"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter User Name"/>
<EditText android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:hint="Enter Password"/>
<TextView android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="2"
    android:text="Large Text"
    android:gravity="center_vertical"/>
<Button android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:text="Login"/>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:orientation="horizontal">
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Register"/>
    <Button android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:text="Help"/>
</LinearLayout>
<View android:layout_width="fill_parent"
    android:layout_height="0dip"
    android:layout_weight="1"/>
</LinearLayout>


检查布局中的使用权重检查布局中的使用权重检查布局中的使用权重检查布局中的使用权重为选定屏幕参数设计的布局文件。阅读并为每个分辨率添加修改后的布局放入相应的文件夹。因此,您应该以可重用的方式编写布局。在布局中使用参数帮助很大。您的布局文件是为选定的屏幕参数设计的。阅读并为每个分辨率添加修改后的布局放入相应的文件夹。因此,您应该以可重用的方式编写布局。在布局中使用参数帮助很大。您的布局文件是为选定的屏幕参数设计的。阅读并为每个分辨率添加修改后的布局放入相应的文件夹。因此,您应该以可重用的方式编写布局。在布局中使用参数帮助很大。您的布局文件是为选定的屏幕参数设计的。阅读并为每个分辨率添加修改后的布局放入相应的文件夹。因此,您应该以可重用的方式编写布局。在布局中使用param会有很大帮助。