<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>
this is my xml file .which is pity much simple. My intention is to increase height of scroll view dynamically and the image (which is with the scroll view) view will be shown gradually.so how can i do that and What is rootLayout here and How i call rootLayout from my code ??
final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { runOnUiThread(new Runnable() { public void run() { secondCounter++; yourNewHeight += 10; sv.getLayoutParams().height = yourNewHeight; LinearLayout root = (LinearLayout) findViewById(R.id.rootLayout); root.invalidate(); Log.v("", ""+sv.getLayoutParams().height); if(secondCounter == 20){ timer.cancel(); } } }); } }, delay, period);
this is my code in java file.But its not working . guys can you help me out..!!!