嗨,我是扑扑的新手,
我试图按照一些教程来制作弯曲的应用程序栏,但我无法达到我想要的结果
经过一些谷歌搜索后,我可以做这个简单的曲线
这是我使用的剪刀代码
class CurvedClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var path = Path();
path.lineTo(0, size.height - 30);
path.quadraticBezierTo(
size.width / 2, size.height, size.width, size.height - 30);
path.lineTo(size.width, 0);
path.close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}
Run Code Online (Sandbox Code Playgroud)
这是我的问题,无论如何将 svg 曲线转换为这个曲线剪刀?
这是我第一次在 android 中处理片段。
并且由于某种原因,当我尝试将片段标签添加到我的主要活动时,我的应用程序崩溃了。我知道有很多问题与我的类似,但我找不到任何对这种情况有用的问题。
活动_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
tools:context="com.group.peixa.test.MainActivity">
<fragment
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.group.peixa.test.BlankFragment"
/>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
fragment_blank.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.group.peixa.test.BlankFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
空白片段.java
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatDialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
*/
public class BlankFragment extends AppCompatDialogFragment {
public BlankFragment() {
// Required empty public constructor
}
@Override
public View …Run Code Online (Sandbox Code Playgroud)