I have severals line which indent a little bit, each line may span to next line if it is too long. I wish to have the left [padding] space to be white background while the background of real text be yellow say. The gap between 2 [padding] needs also to be white.
Essentially, the left space of the real text have different background with the text. How do i do it ?

[padding]Line1 .......................
         ............continue of Line1
[padding]Line2

thank you

有帮助吗?

解决方案

Use something like this:

<LinearLayout
  ...
  android:background="#fff"
  android:orientation="vertical">

    <TextView
        ...
        android:layout_marginLeft="4dp"
        android:background="#ffff00"/>

    <TextView
        ...
        android:layout_marginLeft="4dp"
        android:background="#ffff00"/>

</LinearLayout>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top