I'm creating app similar to this:
Width of one hour is expressed in dp. How can I create such divided (by borders or by different colors) background? I though about inserting ImageViews but is there better method? Currently my layout:
<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>
And I insert elements to relative layouts.
Thanks for help.
SOLUTION
HorizontalScrollView mainView = (HorizontalScrollView) findViewById(R.id.horizontalScrollView1);
Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
int height = size.y;
int width = dpToPixels(dpPerHour);
Bitmap bmpBg = ((BitmapDrawable) getResources().getDrawable(R.drawable.schedule_bg)).getBitmap();
Bitmap scaled = Bitmap.createScaledBitmap(bmpBg, width, height, true);
BitmapDrawable viewBg = new BitmapDrawable(getResources(), scaled);
viewBg.setTileModeX(TileMode.REPEAT);
viewBg.setGravity(Gravity.LEFT);
mainView.setBackground(viewBg);