这RelativeLayout的布局或它的LinearLayout父母也没用 [英] This RelativeLayout layout or its LinearLayout parent is useless

查看:163
本文介绍了这RelativeLayout的布局或它的LinearLayout父母也没用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android 3.1。和上面的应用程序。

I'm developing an Android 3.1. and above application.

在一个活动动态地生成它的布局。我使用的 formdetail.xml 作为内容查看:

On one activity I generate its layout dynamically. I'm using formdetail.xml as contentview:

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.formdetail);

    Bundle extras = getIntent().getExtras();
    if (extras != null)
    {
        currentFormId = extras.getString("FormId");
    }
}

formdetail.xml:

formdetail.xml :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/detailLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
        <Button
            android:id="@+id/downloadFormsButton"
            android:enabled="false"
            android:layout_alignParentLeft="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:text="@string/download_forms_button" />
        <TextView
            android:id="@+id/formErrorMsg"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="10dp"
            android:textSize="16dp" >
        </TextView>
    </RelativeLayout>

</LinearLayout>

downloadFormsButton formErrorMsg 必须始终在形式上。

downloadFormsButton and formErrorMsg must be always in form.

但使用XML,我得到这样的警告:

But using that xml I get this warning:

这RelativeLayout的布局或其母公司的LinearLayout也没用

我需要的LinearLayout以编程方式添加TableLayouts。

I need linearLayout to add TableLayouts programmatically.

我该如何解决这个警告?

How can I solve this warning?

推荐答案

您要么忽略它,或者右键单击您的项目。点击构建Path-&GT;配置构建路径... 。在 Android的皮棉preferences 寻找 UselessParent 并设置它的严重性忽略或点击全部忽略

You either ignore it or right click your project. Click Build Path->Configure Build Path.... Under Android Lint Preferences look for UselessParent and set it's severity to ignore or click Ignore All.

编辑:

我采取的最后一部分了。我觉得全部忽略将清除所有lint警告和错误。

I take that last part back. I think Ignore All will wipe all Lint warnings and errors.

这篇关于这RelativeLayout的布局或它的LinearLayout父母也没用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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