<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:gravity=“center”
android:orientation=“vertical”>
<TextView
android:id=“@+id/tete”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content” />
<ImageView
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:src=“@mipmap/dw64”/>
2、引入自定义view
LayoutInflater mInflater = LayoutInflater.from(this); View view = mInflater.inflate(R.layout.zdyview, null); TextView textView = view.findViewById(R.id.tete); textView.setText("大象"); Bitmap bitmap =convertViewToBitmap(view);