Android的布局正确对准 [英] Android layout correct alignment

查看:183
本文介绍了Android的布局正确对准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个项目,我遇到了一些问题。我还没有与布局工作非常多,所以我不知道这是可能的或没有。

I am working on a project and I have run into some problems. I haven't worked with the layouts very much so I don't know if this is possible or not.

在画面我已经加入该项目实体模型。对于较低的屏幕分辨率看起来很好,但是当我把应用5英寸的设备上,这橙色区域太高了,我想知道是否有可能以某种方式获得该区域的中心。

In the picture I have added the project mock-up. For the lower screen resolution it looks fine, but when I put the app on 5 inch device, this orange area is too high and I wanted to know if it is possible somehow to get that area centered.

橙色区域是一个LinearLayout中,一切都包裹在里面的LinearLayout。希望你明白我的意思是什么,我问。

The orange area is a LinearLayout and everything is wrapped inside LinearLayout. Hope you understand what I mean I what I am asking.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffff0000"
    android:orientation="vertical"
    android:paddingLeft="16dp"
    android:paddingRight="16dp" >

    <LinearLayout
        android:id="@+id/first"
        android:layout_width="match_parent"
        android:layout_height="76dp"
        android:background="#175797"
        android:orientation="vertical" >

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Subject" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/second"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="#00FFFF"
        android:orientation="vertical" >

        <Button
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:text="Send" />
    </LinearLayout>

    <LinearLayout
        android:layout_gravity="bottom"
        android:id="@+id/third"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:background="#FFA500"
        android:orientation="horizontal" >
    </LinearLayout>

</LinearLayout>

这是code为实体模型。该项目是pretty大同小异

This is code for the mock-up. For the project it's pretty much the same

推荐答案

您可以尝试@ g00dy答案,否则

you can try @g00dy answer or else

您必须创造一个平板手机分离的布局(即5英寸设备)

You have to create separate layout for phablet (i.e. 5 inch devices)

在这里,在这个环节他们解释我们如何能够把我们的平板电脑布局...

Here in this link they had explain how we can put our tablets layouts...

在Android开发者网站,他们不得不解释如何管理Android的针对不同屏幕尺寸的布局检查此链接

On android developer site they have had explain how android manage layouts for different screen sizes check this link

这篇关于Android的布局正确对准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆