Мое приложение содержит разные макеты. Одно из них представляет собой линейный макет. Он динамически добавляется в него. Я хочу сделать горизонтальную прокрутку этого макета при добавлении его контента. Для этого я написал код, приведенный ниже.
<LinearLayout android:id="@+id/scoreballparent_layout"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_above="@+id/score_layout">
<HorizontalScrollView android:layout_height="wrap_content"
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/scoreball_layout"
android:layout_height="wrap_content"
>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
это работает .. но я хочу прокрутить его автоматически при добавлении содержимого ... кто-нибудь может мне помочь, плз ...
больше исходного кода:
private void scoreball_display(String score)
{
addscoreball = new Button(getApplicationContext());
addscoreball.setId(134);
if(score=="WD" || score=="NB")
{
addscoreball.setTextAppearance(this,R.style.plainText);
}
else{
addscoreball.setTextAppearance(this,R.style.BoldText);
}
addscoreball.setText(score);
addscoreball.setSingleLine(true);
addscoreball.setBackgroundDrawable(getResources().getDrawable (R.drawable.white_ball));
addscoreball.setGravity(Gravity.CENTER_HORIZONTAL);
addscoreball.setGravity(Gravity.CENTER_VERTICAL);
LinearLayout.LayoutParams addscoreball_Params =
new LinearLayout.LayoutParams(35,35);
scoreballlayout.addView(addscoreball,addscoreball_Params);
}
в этом методе он добавляет больше содержимого в мой макет ...