2017-10-04 150 views
-3

我创建了一个约束布局作为基础布局的android应用程序,我想将其转换为相对布局。我如何做到这一点,而不影响布局内的项目?如何将约束布局转换为相对布局

<android.support.constraint.ConstraintLayout 
    xmlns:android="schemas.android.com/apk/res/android" 
    xmlns:app="schemas.android.com/apk/res-auto" 
    xmlns:tools="schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.android.intent_basics.MainActivit‌​y"> 
+0

显示你的代码更容易调试我们不是生产自己的代码。 – F0XS

+0

joshua

+1

为您的问题**添加代码**,而不是评论。 –

回答

0

从您在问题中发布的内容看,您的约束布局似乎没有任何子视图。如果是这样的情况下,只需更换:

<android.support.constraint.ConstraintLayout 
    xmlns:android="schemas.android.com/apk/res/android" 
    xmlns:app="schemas.android.com/apk/res-auto" 
    xmlns:tools="schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.android.intent_basics.MainActivit‌​y"> 

    ... 

</android.support.constraint.ConstraintLayout> 

有:

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.android.intent_basics.MainActivit‌​y"> 

    ... 

</RelativeLayout>