剪切图片为原形
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView imageView = findViewById( R.id.image1 ); ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setRoundRect(0, 0,50, 50,30); } }; imageView.setOutlineProvider(viewOutlineProvider); imageView.setClipToOutline(true); } }