自定义 UCrop 的布局代码
时间: 2024-02-20 16:00:06 浏览: 25
以下是一个简单的自定义 UCrop 布局代码示例:
```
<FrameLayout
android:id="@+id/ucrop_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.yalantis.ucrop.view.UCropView
android:id="@+id/ucrop"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/ucrop_controls_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<LinearLayout
android:id="@+id/ucrop_aspect_ratio_wrapper"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="@+id/ucrop_aspect_ratio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:layout_marginRight="10dp"
android:src="@drawable/ucrop_ic_aspect_ratio"
android:contentDescription="@string/ucrop_description_scale"/>
<TextView
android:id="@+id/ucrop_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1:1"
android:textColor="@color/ucrop_color_widget_active"
android:textSize="16sp"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<ImageButton
android:id="@+id/ucrop_reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/ucrop_ic_reset"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="10dp"
android:contentDescription="@string/ucrop_description_reset"/>
<ImageButton
android:id="@+id/ucrop_rotate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/ucrop_ic_rotate"
android:layout_toLeftOf="@id/ucrop_reset"
android:layout_toStartOf="@id/ucrop_reset"
android:layout_marginRight="10dp"
android:contentDescription="@string/ucrop_description_rotate"/>
<ImageButton
android:id="@+id/ucrop_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:src="@drawable/ucrop_ic_done"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:contentDescription="@string/ucrop_description_save"/>
</RelativeLayout>
</FrameLayout>
```
你可以根据自己的需要进行修改和定制。