I have created a project in which i design a transparent_panel and arrenge these on canvas i want to apply animation to pannel. can anybody help me.
public class Pannel1 extends LinearLayout{
public Paint innerPaint, borderPaint ;
Canvas c;
public Pannel1(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public Pannel1(Context context) {
super(context);
init();
}
public void init() {
innerPaint = new Paint();
innerPaint.setARGB(225, 75, 75, 75); //gray
innerPaint.setAntiAlias(true);
borderPaint = new Paint();
borderPaint.setARGB(255, 255, 255, 255);
borderPaint.setAntiAlias(true);
borderPaint.setStyle(Style.STROKE);
borderPaint.setStrokeWidth(2);
}
public void setInnerPaint(Paint innerPaint) {
this.innerPaint = innerPaint;
}
public void setBorderPaint(Paint borderPaint) {
this.borderPaint = borderPaint;
}
@Override
public void dispatchDraw(Canvas canvas)
{ c=canvas;
RectF drawRect = new RectF();
drawRect.set(0,0, getMeasuredWidth(),getMeasuredHeight());
canvas.drawRoundRect(drawRect, 10, 10, innerPaint);
canvas.drawRoundRect(drawRect, 10, 10, borderPaint);
super.dispatchDraw(canvas);
}
public void rotet(Canvas c1)
{ c1=this.c;
c1.translate(-10,-10);
dispatchDraw(c1);
}
}
and my xml file is
?xml version="1.0" encoding="utf-8"?>
<!--<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"> -->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<com.android.panel.Pannel1
android:id="@+id/transparent_panel1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px"
android:layout_marginTop="50px"
android:layout_marginLeft="20px"
android:layout_marginRight="20px" android
nClick="@string/buttonHandler2" android:clickable="true" android:focusable="true">
<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Back" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel1>
<com.android.panel.Pannel4
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px" android:layout_marginTop="50px" android:layout_marginRight="10px">
<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel4>
</TableRow>
<TableRow >
<com.android.panel.Pannel2
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px" android:focusableInTouchMode="true" android:hapticFeedbackEnabled="true"
android:layout_marginRight="10px" android:layout_marginTop="50px" >
<Button android:text="@+id/Button04" android:id="@+id/Button04" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button02" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel2>
<com.android.panel.Pannel5
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px" android:layout_marginTop="50px" android:layout_marginRight="10px" >
<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel5>
<com.android.panel.Pannel6
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px" android:layout_marginTop="50px" >
<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel6>
</TableRow>
<TableRow>
<com.android.panel.Pannel3
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px" android:layout_marginLeft="20px" android:layout_marginRight="20px" android:layout_marginTop="50px" android:layout_marginBottom="30px">
<Button android:text="@+id/Button02" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button05" android:id="@+id/Button05" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel3>
<com.android.panel.Pannel7
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android
addingTop="5px"
android
addingLeft="5px"
android
addingBottom="5px"
android
addingRight="5px" android:layout_marginRight="20px" android:layout_marginTop="50px" android:layout_marginBottom="30px">
<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel7>
</TableRow>
</TableLayout>
<!-- </LinearLayout>
how can i apply zoom effect to indivisual pannel.
public class Pannel1 extends LinearLayout{
public Paint innerPaint, borderPaint ;
Canvas c;
public Pannel1(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public Pannel1(Context context) {
super(context);
init();
}
public void init() {
innerPaint = new Paint();
innerPaint.setARGB(225, 75, 75, 75); //gray
innerPaint.setAntiAlias(true);
borderPaint = new Paint();
borderPaint.setARGB(255, 255, 255, 255);
borderPaint.setAntiAlias(true);
borderPaint.setStyle(Style.STROKE);
borderPaint.setStrokeWidth(2);
}
public void setInnerPaint(Paint innerPaint) {
this.innerPaint = innerPaint;
}
public void setBorderPaint(Paint borderPaint) {
this.borderPaint = borderPaint;
}
@Override
public void dispatchDraw(Canvas canvas)
{ c=canvas;
RectF drawRect = new RectF();
drawRect.set(0,0, getMeasuredWidth(),getMeasuredHeight());
canvas.drawRoundRect(drawRect, 10, 10, innerPaint);
canvas.drawRoundRect(drawRect, 10, 10, borderPaint);
super.dispatchDraw(canvas);
}
public void rotet(Canvas c1)
{ c1=this.c;
c1.translate(-10,-10);
dispatchDraw(c1);
}
}
and my xml file is
?xml version="1.0" encoding="utf-8"?>
<!--<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"> -->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<com.android.panel.Pannel1
android:id="@+id/transparent_panel1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

android:layout_marginTop="50px"
android:layout_marginLeft="20px"
android:layout_marginRight="20px" android

<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Back" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel1>
<com.android.panel.Pannel4
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel4>
</TableRow>
<TableRow >
<com.android.panel.Pannel2
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

android:layout_marginRight="10px" android:layout_marginTop="50px" >
<Button android:text="@+id/Button04" android:id="@+id/Button04" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button02" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel2>
<com.android.panel.Pannel5
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel5>
<com.android.panel.Pannel6
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel6>
</TableRow>
<TableRow>
<com.android.panel.Pannel3
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

<Button android:text="@+id/Button02" android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button05" android:id="@+id/Button05" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel3>
<com.android.panel.Pannel7
android:id="@+id/transparent_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android

android

android

android

<Button android:text="@+id/Button01" android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
<Button android:text="@+id/Button03" android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button>
</com.android.panel.Pannel7>
</TableRow>
</TableLayout>
<!-- </LinearLayout>
how can i apply zoom effect to indivisual pannel.