I extend LinearLayout
and create my own class GameLinerLayout
and then I create class LudoGame
that extend that class GameLinerLayout
.
Now I try to use it in my layout "main.xml"
<android.game.ludo.LudoGame xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_absolute"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
</android.game.ludo.LudoGame>
but I can't make it work "background" parameter. So how to set background image on my own view?
I don't understand this. I have my layout and I just want to set the background on that view (there is no other views) and if I do this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/wood">
<android.game.ludo.LudoGame xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_absolute"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</android.game.ludo.LudoGame>
</LinearLayout>
It does not display anything and if I set "android:background="#FFFFFF"" on "LudoGame" layout then I see content but without background. Can you show me some example how to resolve this?
Thanks.
That is the same way how my Layout work GameLinerLayout extends LinearLayout And I @Override onDraw method where is object Canvas and where I draw content
@Override
protected void onDraw(Canvas canvas)
{
super.dispatchDraw(canvas);
drawFields(canvas);
}
But I don't want to draw background image with Canvas, I would like (if it possible) to set that background in XML when I try to defined(use) my Layout