2014-09-16 1 views
0

Androidplot을 사용하는 내 활동의 스크린 샷을 만들 때 'Could'nt 캡처 캡처 스크린 샷 - 저장 공간이 사용 중임'메시지가 표시됩니다. Androidplot 그래프가 활동에 배치되지 않으면 스크린 샷을 완벽하게 찍을 수 있습니다. 이 라인을 포함 샘플 코드에 불행한 실수 때문이다Androidplot couldnt screenshot

private void renderAndroidPlot() 
{ 
    // on ICS+ devices :-) 
    getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, 
      WindowManager.LayoutParams.FLAG_SECURE); 

    // initialize our XYPlot reference: 
    plot = (XYPlot) getView().findViewById(R.id.mySimpleXYPlot); 

    // Create a couple arrays of y-values to plot: 
    Number[] series1Numbers = getGraphData(); 

    // Turn the above arrays into XYSeries': 
    XYSeries series1 = new SimpleXYSeries(
      Arrays.asList(series1Numbers),   // SimpleXYSeries takes a List so turn our array into a List 
      SimpleXYSeries.ArrayFormat.XY_VALS_INTERLEAVED, // Y_VALS_ONLY means use the element index as the x value 
      "Series1");        // Set the display title of the series 


    // add a new series' to the xyplot: 
    plot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE); 
    plot.getGraphWidget().getBackgroundPaint().setColor(Color.WHITE); 
    plot.setBorderStyle(Plot.BorderStyle.NONE, null, null); 

    Paint lineFill = new Paint(); 
    lineFill.setAlpha(200); 
    lineFill.setShader(new LinearGradient(0, 0, 0, 250, Color.WHITE, Color.parseColor("#99E6B1"), Shader.TileMode.MIRROR)); 
    LineAndPointFormatter formatter = new LineAndPointFormatter(Color.rgb(0, 0,0), null, null,null); 
    formatter.setFillPaint(lineFill); 

    plot.setPlotMargins(0, 0, 0, 0); 
    plot.setPlotPadding(0, 0, 0, 0); 

    plot.getGraphWidget().setMarginTop(30); 
    plot.getGraphWidget().setMarginRight(50); 
    plot.getGraphWidget().setMarginLeft(50); 
    plot.getGraphWidget().setMarginBottom(50); 



    plot.getGraphWidget().getDomainLabelPaint().setColor(Color.BLACK); 
    plot.getGraphWidget().getRangeLabelPaint().setColor(Color.BLACK); 

    plot.getGraphWidget().getDomainOriginLabelPaint().setColor(Color.BLACK); 
    plot.getGraphWidget().getDomainOriginLinePaint().setColor(Color.BLACK); 
    plot.getGraphWidget().getRangeOriginLinePaint().setColor(Color.BLACK); 


    // reduce the number of range labels 
    plot.setTicksPerRangeLabel(3); 
    plot.getGraphWidget().setDomainLabelOrientation(0); 

    //Remove legend 
    plot.getLayoutManager().remove(plot.getLegendWidget()); 
    //plot.getLayoutManager().remove(plot.getDomainLabelWidget()); 
    plot.getLayoutManager().remove(plot.getRangeLabelWidget()); 
    plot.getLayoutManager().remove(plot.getTitleWidget()); 

    plot.setDomainStep(XYStepMode.SUBDIVIDE, 6); 

    plot.addSeries(series1, formatter); //new LineAndPointFormatter(Color.parseColor("#2E64FE"), null, null, null)); 



} 
+0

코드 스 니펫에 일부 스냅 사진을 표시 할 수 있습니까? – keshav

+0

이 코드로 내 메인 쿼리를 업데이트했습니다. - 감사합니다. – user3792936

답변

1

:

getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, 
    WindowManager.LayoutParams.FLAG_SECURE); 

작동합니다 코드와 화면 캡처에서 해당를 제거합니다.

0
// on ICS+ devices :-) 
getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, 
     WindowManager.LayoutParams.FLAG_SECURE); 

이 재미있는 작은 블록은 사용자가 스크린 샷을 찍을 수 없도록 만들어졌습니다. 그것을 제거하면 스크린 샷을 찍을 수 있습니다.

+1

2014 년에이 질문에 대한 답을 알고 있습니까? 또한 이미 게시 된 답변과 동일합니다. 현저하게 다른 경우이거나 이미 게시 된 다른 사람들의 의견을 개선하는 경우에만 늦은 답변을 게시하십시오. –