我的應用程序包含不同的佈局。其中一個是線性佈局。它的內容是動態添加的。我希望在添加內容時使此佈局水平滾動。我寫了下面給出的代碼..如何使線性佈局在動態添加內容時自動滾動
<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>
是working..but我想自動滾動它同時增加了內容......任何人可以幫助我PLZ ...
多個源代碼:
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);
}
在這種方法是增加更多的內容,我的佈局
...
我試過但不工作 – 2011-06-15 08:26:40
你能發表更多源代碼嗎? – 2011-06-15 09:08:02
我貼過多個源代碼 – 2011-06-15 13:09:01