Android ignoring my setWidth() and setHeight()
- by popoffka
So, why does this code:
package org.popoffka.apicross;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
public class Game extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Button testButton = new Button(this);
testButton.setBackgroundResource(R.drawable.cell);
testButton.setWidth(20);
testButton.setHeight(20);
setContentView(testButton);
}
}
...produce this thing:
http://i42.tinypic.com/2hgdzme.png even though there's a setWidth(20) and setHeight(20) in the code?
(R.drawable.cell is actually a 20x20 PNG image containing a white cell with a silver border)