线性布局中的坐标布局:组件未固定

时间:2017-03-28 10:15:23

标签: android android-layout android-linearlayout android-coordinatorlayout

如标题所述,圆形图像视图中的android徽标位置不固定。

应用程序有时会像我设计的那样正确呈现: Layout behave correctly

但有时布局会以这种方式表现: Layout behave incorrectly

下面附上我的布局.xml代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="275dp">

    <ImageView
        android:id="@+id/profile_iv_background"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:scaleType="fitXY"
        android:src="@drawable/profile_bg"/>

    <com.makeramen.roundedimageview.RoundedImageView
        android:id="@+id/profile_riv_user"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:scaleType="fitCenter"
        android:src="@mipmap/ic_launcher"
        app:layout_anchor="@id/profile_iv_background"
        app:layout_anchorGravity="bottom|center"
        app:riv_border_color="#333333"
        app:riv_border_width="2dip"
        app:riv_corner_radius="30dip"
        app:riv_oval="true"
        app:riv_tile_mode="clamp" />


</android.support.design.widget.CoordinatorLayout>

<TextView
    android:id="@+id/profile_tv_full_name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:textSize="30sp"/>

<android.support.v7.widget.RecyclerView
    android:id="@+id/profile_rv_info"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

任何想法都会受到赞赏。

0 个答案:

没有答案