2016-12-12 2 views
0

버튼을보기 위해 androidplot을 함께 스크롤 뷰에 넣을 수없는 것 같습니다. androidplot 0.9.8을 사용하고 있습니다.스크롤 뷰에 버튼과 androidplot 추가하기

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:ap="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="example.example.MainActivity"> 
    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:fillViewport="true"> 
     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/plotLayout"> 
      <com.androidplot.xy.XYPlot 
        android:id="@+id/plot" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        ap:Label="test" 
        ap:domainLabel="test" 
        ap:rangeLabel="test" 
        ap:renderMode="use_main_thread"/> 
      <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="horizontal" 
        android:layout_below="@id/plot"> 
        <Button 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_weight="1" 
         android:text="test"/> 
        <Button 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_weight="1" 
         android:text="test"/> 
        </LinearLayout> 
     </RelativeLayout> 
</ScrollView> 

편집 : 그것은 내가 (androidplot에 대한 특정 높이를 지정할 때 그러나 보인다 예를 들어 안드로이드 : = "가 600dp"대신 안드로이드의 layout_height : layout_height = 여기

내 XML 파일입니다 "match_parent") 잘 스크롤됩니다. 왜 match_parent를 사용하면 스크롤하는 것을 막을 수 있습니까?

+0

RelativeView가 제대로 닫히지 않았습니다. –

+0

죄송합니다. 오타입니다. 여전히 동일한 문제가 발생했습니다 –

답변

0

프로그래밍 방식으로 수동으로 크기를 설정하여 해킹 할 수있었습니다. 플롯의 레이아웃 매개 변수를 가져 와서 수동으로 높이를 변경할 수 있습니다. 높이와 함께 일종의 문제가있는 것 같아요? 당신이 두보기로 ScrollView의 내부에 사용하는 경우 닭고기와 달걀 시나리오를 만들어 플롯의 높이 match_parent의 값을 사용하고 같은

XYPlot plot = (XYPlot) findViewById(R.id.plot); 
LayoutParams lp = plot.getLayoutParams(); 
lp.height = 1710; // You can set it to whatever height you require it to be, 1710 is just an example 
plot.setLayoutParams(lp); 
1

는 크기가 무엇을 말하고 다른에 따라 달라 보이는 될 것입니다.

여기에서 할 일은 레이아웃 xml에서 플롯의 높이를 명시 적으로 지정하는 것입니다. 해당 옵션이 아니라면 다음을 추가하십시오.

android:fillViewport="true" 

또한 scrollview의 XML에 트릭을 수행 할 수 있습니다. (보통은 작동하지만 여러 가지 상황에서 반대로 보고서를 들었습니다.) This blog post은 기본 문제에 대해 좀 더 자세히 설명합니다.

+0

원래 안드로이드 : fillViewport = "true"를 추가하여 효과가 없습니다 (원래 게시물에서 볼 수 있듯이). 플롯 높이를 Android 화면의 크기로 설정하려고했는데, 이는 XML에서 명시 적으로 상태를 표시 할 수 없음을 의미합니다. 프로그래밍 방식으로 수행하는 것이 현재로서는 최상의 옵션 일 수있는 것처럼 보입니다. 그래도 감사합니다 –