导入xml
public class Bottom extends LinearLayout {
public Bottom(Context context) {
this(context,null);
}
public Bottom(Context context, @Nullable AttributeSet attrs) {
this(context, attrs,0);
}
public Bottom(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.activity_below_button, this, true);
}
}
把文件导入到需要的地方
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.example.musicplayer.Bottom
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
an