2012-07-13 9 views
1

ScrollView의 높이를 점차적으로 높이는 프로세스가 런타임에 있습니까? 내 의도는 점차적으로 ScrollView 내에있는 이미지를 보여주는 것입니다. 그래서 ScrollView의 높이를 높이고 싶습니다. 내 일을 할 수있는 방법이 있습니까 ?? 제발 도와주세요 내 XMLFILE의 out.Content은 다음과 같습니다ScrollView 내에서 점진적으로 이미지를 표시하는 방법은 무엇입니까?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/rootLayout" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="wrap_content" 
     android:layout_height="80dp" 
     android:scrollbars="none" 
     android:layout_x="0dp" 
     android:layout_y="0dp" 
     android:fillViewport="true" > 

     <LinearLayout 
      android:id="@+id/linearLayout1" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 


    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_x="0dp" 
     android:layout_y="0dp" 
     android:src="@drawable/background" /> 
     </LinearLayout> 

    </ScrollView> 

    </LinearLayout> 

내 코드는 다음과 같습니다

enter image description here

흐리게 이미지에서 함께 : 여기

final Timer timer = new Timer(); 
    timer.scheduleAtFixedRate(new TimerTask() { 
     public void run() { 
      runOnUiThread(new Runnable() 
      { 
       public void run() { 

        secondCounter++; 
        yourNewHeight += 10; 
        // sv is object of scroll view 
        sv.getLayoutParams().height = yourNewHeight; 

        root.invalidate(); // root is rootview 


        if(secondCounter == 20){ 
         timer.cancel(); 
        } 
       } 
      }); 
     } 
    }, delay, period); 

내 스크린 샷 ScrollView의 높이와 ScrollView의 높이가 흐리게 표시된 이미지를 점차 보여주고 있습니다.

+0

이미지를 프로그램 적으로 더 추가 하시겠습니까 ?? – AkashG

+0

no. 이미 scrollView에있는 하나의 이미지 만. – Amitabha

+0

pls 내게 당신이 보여주고 싶은 것을 분명히 해두는 이유는 오직 하나의 이미지가 있기 때문입니다. – AkashG

답변

0

내가 코드를 편집 한 ..

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rootLayout" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

<ScrollView 
    android:id="@+id/scrollView1" 
    android:layout_width="fill_parent" 
    android:layout_height="80dp"> 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width=" fill_parent" 
     android:layout_height="wrap_content" > 


<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:src="@drawable/background" /> 
    </LinearLayout> 

</ScrollView> 

하기 프로그래밍 방식 너비와 높이를 설정합니다 setLayoutParams(..)을 사용할 수 있습니다

+0

nope .. :(내 Java 코드를 게시해야합니까? – Amitabha

+0

ur 코드를 게시해야합니다 .... 그래서 우리는 그것을 확인할 수 있습니다 .. –

+0

완료되었습니다 !! !! 확인해보십시오 .plzzz .. !!! – Amitabha

0

.. 날이 아닌지 ... 확인 짓을 한거야 알려 주시기 바랍니다. maohere과 그 해결책을 주었다.

+0

높이 스크롤보기가 고정되지 않습니다. 주기적으로 증가합니다. – Amitabha

관련 문제