这RelativeLayout的布局或它的LinearLayout父母也没用它的、也没用、布局、父母

由网友(Reincarnation.(轮回.))分享简介:我开发一个Android 3.1。和上面的应用程序。I'm developing an Android 3.1. and above application.在一个活动动态地生成它的布局。我使用的 formdetail.xml 作为内容查看:On one activity I generate its layou...

我开发一个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.

阅读全文

相关推荐

最新文章