Я пишу приложение для Android, у которого есть представление прокрутки, которое содержит линейное отображение:
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity=top"
android:layout_marginTop="240dip"
android:layout_marginRight="0dip"
android:layout_marginBottom="60dip">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/centerlayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="top"
android:layout_marginRight="20dip"
android:layout_marginLeft="10dip"
android:layout_marginBottom="120dip">
Как видите, верхний край поля прокрутки равен 240dip.Я хочу иметь возможность изменить это в моем коде Java.Я попробовал это:
ScrollView scrollView=(ScrollView)findViewById(R.id.ScrollView01);
LayoutParams params=scrollView.getLayoutParams();
Но я не могу сделать это: params.top = 100;Не могли бы вы помочь мне, как я могу это сделать?