要解决Android ChipDrawable不填充其父级视图宽度的问题,可以使用以下代码示例:
ImageView chipImage = findViewById(R.id.chip_image);
Drawable drawable = getResources().getDrawable(R.drawable.chip_drawable); // 替换为自己的ChipDrawable资源
// 获取ImageView的宽度
int width = chipImage.getWidth();
// 设置ChipDrawable的宽度为ImageView的宽度
drawable.setBounds(0, 0, width, drawable.getIntrinsicHeight());
// 将ChipDrawable设置为ImageView的背景
chipImage.setBackground(drawable);
请确保将代码中的R.drawable.chip_drawable
替换为您自己的ChipDrawable资源。这样,ChipDrawable将会填充其父级视图的宽度。