android控件-View整理

  1. View转为图片Bitmap

public static Bitmap convertViewToBitmap(View view){

      view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),                   MeasureSpec.makeMeasureSpec(0,                       MeasureSpec.UNSPECIFIED));

        view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());

         view.buildDrawingCache();

        Bitmap bitmap = view.getDrawingCache();

       return bitmap;

}

2.View 通常作为分割线

 如:

 <View

        android:layout_width="match_parent"

        android:layout_height="0.5dp"

        android:background="#959595"

        />


你可能感兴趣的:(android控件-View整理)