FILL_PARENT不填充整个屏幕中的LinearLayout [英] fill_parent is not filling entire screen in LinearLayout

查看:489
本文介绍了FILL_PARENT不填充整个屏幕中的LinearLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图寻找这个答案,我得到了一个答案是增加Android上的最靠近:调整大小=真,这是德precated。我很抱歉,如果这个问题已经回答了,但我无法找到它,如果它是。

I tried to search for this answer and the closest I got to an answer was to add android:resizable="true", which is deprecated. I apologize if this question has been answered but I couldn't find it if it was.

不管怎样,我的应用程序不填充整个屏幕。我使用的方法是在工作的Andr​​oid 2.2,但我现在用的是2.3模拟器,它不工作。我不知道这是否是真正的问题还是不行。

Anyway, my app is not filling the entire screen. The method I was using was working in android 2.2 but I am now using a 2.3 emulator and it's not working. I am not sure if this is actually the issue or not.

现在的问题...

我创建一个温度转换应用程序(是的,这是家庭作业)和应用程序是不充盈,即使我说FILL_PARENT为layout_width和高度的的LinearLayout整个屏幕。一个我看到的建议是使用一个RelativeLayout的,这是我能做到,我想,但它似乎是一个创可贴,而不是一个解决方案。应该不是这个工作?

I am creating a temperature converter app (yes, it's homework) and the app is not filling the entire screen even though I say fill_parent for the layout_width and height in the LinearLayout. A suggestion I saw was to use a RelativeLayout, which I could do I suppose but it seems like a band-aid, not a solution. Shouldn't this work?

下面是我的code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="center_vertical"
    android:background="@color/white"
    >

    <TextView  
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Temperature Converter"
        android:textColor="@color/black"
        />

    <RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/convertGroup"
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
        <RadioButton android:id="@+id/CtoF"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Celsius to Fahrenheit"
            android:textColor="@color/black"
            />
        <RadioButton android:id="@+id/FtoC"
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Fahrenheit to Celsius"
            android:textColor="@color/black"
            />
    </RadioGroup>

    <EditText
        android:id="@+id/tempInput"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:hint="Temperature"
    />

    <TextView  
        android:id="@+id/converted"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:textColor="@color/black"
    />
</LinearLayout>

下面是结果:

推荐答案

在下面添加code在menifest后应用标签

Add below code in menifest after application tag

<supports-screens android:resizeable="true"
                      android:smallScreens="true" 
                      android:normalScreens="true" 
                      android:largeScreens="true"

                      android:anyDensity="true" />

这篇关于FILL_PARENT不填充整个屏幕中的LinearLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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