Paint paint = new Paint();//核心
TextView textView = (TextView) inflater.inflate(
R.layout.item_textview, null);
paint.setTextSize(textView.getTextSize());//核心
int itemPadding = textView.getCompoundPaddingLeft()
+ textView.getCompoundPaddingRight();
String text="xxx";
float itemWidth = paint.measureText(text) + itemPadding;//核心