I have problem with Using of my Custom View in the table layout.
This is example of code:
This is custom view which just draw line:
Using java Syntax Highlighting
- class CanvasTest extends View {
- CanvasTest(Context context, AttributeSet attrs, Map inflateParams) {
- super(context, attrs, inflateParams);
- // TODO Auto-generated constructor stub
- } @Override protected void onDraw(Canvas canvas) { Paint paint = new Paint(); canvas.drawLine(0, 0, this.getWidth()-2, 0, paint); }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
This is example of using custom view with table layout:
Using java Syntax Highlighting
- CanvasTest child = new CanvasTest(context, attrs, inflateParams);
- child.setPreferredHeight(15);
- child.setPreferredWidth(15);
- daysOfWeek3.addView(child, new TableRow.LayoutParams());
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
The problem is: setPreferredHeight does not work, so Width has size 15, but Height is always 128, but as you see i set height to 15.
does somebody know what is the problem here?
Thanks in advance!
Artem




