的Andr​​oid / Eclipse中:此布局的LinearLayout或其母公司的RelativeLayout可能是没用的 [英] Android/Eclipse: This LinearLayout layout or its RelativeLayout parent is possibly useless

查看:161
本文介绍了的Andr​​oid / Eclipse中:此布局的LinearLayout或其母公司的RelativeLayout可能是没用的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到在Android应用程序谟以下警告Eclipse的:

此的LinearLayout布局或其母公司的RelativeLayout可能是没用的

想不通的问题是什么。阅读其他论坛,但他们并没有帮助。任何想法?

这里的code:

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:重力=顶>    <的LinearLayout
        机器人:ID =@ + ID / lin_progress_bar
        机器人:layout_width =200dp
        机器人:layout_height =65dp
        机器人:layout_marginLeft =60dp
        机器人:layout_marginTop =150dp
        机器人:知名度=隐形>        <进度
            机器人:ID =@ + ID / ProgressBar01
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT>
        < /进度>        <的TextView
            机器人:ID =@ + ID / TextView01
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT
            机器人:layout_marginLeft =30dp
            机器人:layout_marginTop =5DP
            机器人:重力=center_vertical
            机器人:文字=@字符串/加载
            机器人:文字颜色=#808080
            机器人:TEXTSIZE =17sp
            机器人:文字样式=大胆>
        < / TextView的>
    < / LinearLayout中>< / RelativeLayout的>


解决方案

这是布局的简化版本:

 <?XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    >
    <进度
        机器人:ID =@ + ID / ProgressBar01
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_marginLeft =60dp
        机器人:layout_marginTop =150dp
        机器人:知名度=隐形
    />
    <的TextView
        机器人:ID =@ + ID / TextView01
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:layout_marginLeft =30dp
        机器人:layout_marginTop =5DP
        机器人:重力=center_vertical
        机器人:文字=@字符串/加载
        机器人:文字颜色=#808080
        机器人:TEXTSIZE =17sp
        机器人:文字样式=大胆
    />
< / RelativeLayout的>

现在它的平整度已经深入人心 - 它转换为更好的性能。

I am getting the following warning in Android Application Projet on Eclipse:

This LinearLayout layout or its RelativeLayout parent is possibly useless

Can't figure out what problem is. Read other forums but they didn't help. Any ideas?

Here's the code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="top" >

    <LinearLayout
        android:id="@+id/lin_progress_bar"
        android:layout_width="200dp"
        android:layout_height="65dp"
        android:layout_marginLeft="60dp"
        android:layout_marginTop="150dp"
        android:visibility="invisible" >

        <ProgressBar
            android:id="@+id/ProgressBar01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
        </ProgressBar>

        <TextView
            android:id="@+id/TextView01"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="5dp"
            android:gravity="center_vertical"
            android:text="@string/loading"
            android:textColor="#808080"
            android:textSize="17sp"
            android:textStyle="bold" >
        </TextView>
    </LinearLayout>

</RelativeLayout>

解决方案

This is the simplified version of your layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ProgressBar
        android:id="@+id/ProgressBar01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="60dp"
        android:layout_marginTop="150dp"
        android:visibility="invisible"
    />
    <TextView
        android:id="@+id/TextView01"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="5dp"
        android:gravity="center_vertical"
        android:text="@string/loading"
        android:textColor="#808080"
        android:textSize="17sp"
        android:textStyle="bold"
    />
</RelativeLayout>

Now it has gained in flatness - which translates is better performances

这篇关于的Andr​​oid / Eclipse中:此布局的LinearLayout或其母公司的RelativeLayout可能是没用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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