線下我有一個佈局,在動態循環增加TextView
的:編程得出的TextView
TextView msg = new TextView(this);
TextView Bmsg = new TextView(this);
msg.setText(splittedItem[0]);
msg.setTextColor(0xFF2C85A6);
msg.setTextSize(22);
msg.setPadding(10, 10, 0, 10);
Bmsg.setText("- "+splittedItem[1]);
Bmsg.setPadding(20, 0, 10, 30);
Bmsg.setTextSize(18);
linearLayout.addView(msg);
linearLayout.addView(Bmsg);
我想每個TextView
有這樣一行劃分:
我需要在Bmsg
下的一行。我發現這個 - draw line under TextView on Android,但我不明白如何編程。
:
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/buttonlayout">
</LinearLayout>
但是你應該考慮像素密度而不是使用2,因爲這可能不總是給出相同的結果。 –
是的,它的工作! TNX –