0

使用Android Studio时,我遇到了约束布局。我用下面的链接提到要了解所有关于它:在ConstraintLayout中,我们在RelativeLayout中使用'app',我们使用'android'。为什么?

https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html#RelativePositioning

但我仍然有一个小问题。在RelativeLayout中,我们使用android:layout_alignParentBottomandroid:layout_alignParentTop等。它们都以android开头。但在ConstraintLayout中,我们必须使用app:layout_constraintLeft_toRightOf等。

你能解释一下使用appandroid前缀和它们的重要性之间的区别吗?

+0

因为约束布局是支持库的一部分,所以它支持的资源值必须单独添加。 –

+0

请参阅下面的链接。我希望它有帮助。 [Android布局 - 何时使用应用程序:vs android:?](https://stackoverflow.com/questions/28045648/android-layout-when-to-use-app-vs-android)[什么是'应用程序' Android的XML名称空间?](https://stackoverflow.com/questions/26692233/what-is-the-app-android-xml-namespace)[android:和android:XML前缀应用程序的区别?](https:/ /stackoverflow.com/questions/29732512/difference-between-android-and-app-prefix-in-android-xml) –

回答

0

android通常用于来自Android SDK本身的属性。

app通常在使用支持库时使用。

ConstraintLayout是支持库中的新布局。因此“应用程序”

相关问题