안드로이드 개발 질문/답변
(글 수 45,052)
graph를 그리는 View를 상속받은 GraphView 클래스가 있습니다 -그래프는 그려 집니다-
이제 MainActivity에서
이제 MainActivity에서
private ScrollView scrollView;
private String tag = getClass().getSimpleName();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout.LayoutParams llp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
scrollView = (ScrollView)getWindow().getDecorView().findViewById(R.id.scrollView);
float[] values = new float[] {5.0f,2.0f,3.0f,1.0f ,4.0f };
String[] verlabels = new String[] { "50","40" , "30","20","10", "0" };
String[] horlabels = new String[] { "0","1","2","3","4","5"};
GraphView graphView = new GraphView(this
, values
, "GraphViewDemo"
, horlabels
, verlabels
, GraphView.LINE
, Color.DKGRAY
, Color.WHITE
, Color.DKGRAY
, Color.WHITE
, Color.LTGRAY);
llp.weight = 1.0f;
graphView.setLayoutParams(llp);
Log.e(tag, "graphView.getWidth() : "+graphView.getLayoutParams().width);
Log.e(tag, "graphView.getHeight() : "+graphView.getLayoutParams().height);
LinearLayout Lin = new LinearLayout(this);
Lin.setOrientation(LinearLayout.HORIZONTAL);
Lin.addView(graphView , llp);
scrollView.addView(Lin, llp);
}
이런식으로 호출하여 scrollView에 add시켜줬습니다 이때 graph는 화면 사이즈보다 큽니다
그래서 scrollview안에 넣었으니 스크롤이 가능 하여 하는데 왜 안되는지 모르겠습니다
읽어주셔서 감사합니다


