布局未对齐到父视图的中心 我试图在两个不同颜色的线性布局中间排列一个圆形图像,但是由于某种原因,该视图与中心不对齐。 但请靠左,我想在它下面放一个碎片。有什么帮助吗 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="3" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#1b96d9" android:orientation="vertical" > </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#e6e6e6" android:orientation="vertical" > </LinearLayout> </LinearLayout> <com.mikhaellopez.circularimageview.CircularImageView xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="10dp" android:gravity="center" android:src="@drawable/doge" app:border_color="#EEEEEE" app:border_width="4dp" app:shadow="true" /> </FrameLayout> <LinearLayout android:id="@+id/calendarCard1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="7" android:background="#e6e6e6" /> </LinearLayout>

布局未对齐到父视图的中心 我试图在两个不同颜色的线性布局中间排列一个圆形图像,但是由于某种原因,该视图与中心不对齐。 但请靠左,我想在它下面放一个碎片。有什么帮助吗 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="3" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" android:background="#1b96d9" android:orientation="vertical" > </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#e6e6e6" android:orientation="vertical" > </LinearLayout> </LinearLayout> <com.mikhaellopez.circularimageview.CircularImageView xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="10dp" android:gravity="center" android:src="@drawable/doge" app:border_color="#EEEEEE" app:border_width="4dp" app:shadow="true" /> </FrameLayout> <LinearLayout android:id="@+id/calendarCard1" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="7" android:background="#e6e6e6" /> </LinearLayout>,android,android-view,android-framelayout,Android,Android View,Android Framelayout,为什么不使用一个相对布局而不是这么多嵌套的线性布局呢。使用相对布局既简单又高效。检查此项以了解相关布局您的圆形图像布局与线性布局一起位于框架布局内。FrameLayout基本上将其所有子项放在另一个子项上。因为使用相对布局也不起作用,另外,你不能使用相对布局来创建一个依赖于权重的视图,但是只使用线性布局。不正确地替换Cm。MikHaelopeZ.ValuaIrimeVIEW。

为什么不使用一个相对布局而不是这么多嵌套的线性布局呢。使用相对布局既简单又高效。检查此项以了解相关布局

您的圆形图像布局与线性布局一起位于框架布局内。FrameLayout基本上将其所有子项放在另一个子项上。

因为使用相对布局也不起作用,另外,你不能使用相对布局来创建一个依赖于权重的视图,但是只使用线性布局。不正确地替换Cm。MikHaelopeZ.ValuaIrimeVIEW。