Dynamiczne tło

0

Próbuję stworzyć coś, co będzie wyglądało tak jak tutaj:
user image
Poradziłem sobie z obliczaniem szerokości kontrolki wydarzenia bazując na czasie trwania.

    <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/horizontalScrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:id="@+id/tableLayout" android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="vertical">
            <RelativeLayout android:id="@+id/tableRowLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content"></RelativeLayout>
            <RelativeLayout android:id="@+id/tableRowLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content"></RelativeLayout>
        </LinearLayout>
    </HorizontalScrollView>

Kontroli dodawane są do relative layoutów.
Ale nie mam pojęcia jak można zrobić takie tło (jak to białe, podzielone poziomo), przy założeniu, że zmienna jest ilość wyświetlanych godzin w każdym dniu. Jakieś pomysły?

0

Możesz użyć <View></View> o szerokości 1dp i jakimś tle (pomiędzy komponentami), compound drawable na zwykłym komponencie, albo np. shape jako tło drawableLeft czy drawableTop:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
        <solid android:color="#ffffff" />
	<stroke android:width="1dip" android:color="#cdcdcd"/>
</shape>

1 użytkowników online, w tym zalogowanych: 0, gości: 1