2015-04-03 40 views
0


进出口试图对准两个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> 

回答

0

您的圆形图像布局与一起在LinearLayout之内。 FrameLayout基本上把所有的孩子放在另一个上面。

+0

不正确使用常规ImageView替换“com.mikhaellopez.circularimageview.CircularImageView”,您会看到它将其放置在顶部部分的中间。 – crazyPixel 2015-04-03 22:03:49