Android에서 내 이미지 및 버튼에 문제가 있습니다. 기본적으로 그래픽을 정의 할 때 "setImageDrawable"메서드를 사용합니다.메서드 setImageDrawable/setBackgroundDrawable 이미지 크기 문제
http://img36.imageshack.us/img36/7713/screenshot20120330at211.png
제가 가야하는 동안 : :하지만이 방법은 이미지가이 같은 전망을 '과충전'확대하고 있습니다
http://img850.imageshack.us/img850/883/screenshot20120330at214.png
두 번째 사진은 내가 무엇을 얻을 때 I "setImageDrawable"대신 "setBackgroundDrawable"을 사용하십시오.
// Button "myButton" initialization
this.btn_connexion_off_480x800 = new ImageButton(this.getContext()); // ImageButton instantiation
this.btn_connexion_off_480x800.setBackgroundColor(Color.TRANSPARENT); // Paramétrage du background
this.btn_connexion_off_480x800.setImageDrawable(getResources().getDrawable(R.drawable.btn_connexion_off_480x800)); // Graphic source definition
this.btn_connexion_off_480x800.setPadding(0, 0, 0, 0); // Paramétrage des marges intérieures
this.img_header_480x800.addView(this.btn_connexion_off_480x800, new AbsoluteLayout.LayoutParams(114, 50, 8, 12)); // Binding to the super view and setting coordinates
사람이 알고 있나요 왜 이런 일이 :하지만 그렇게 할 올바른 방법은 내 코드는 내가 진행하는 방법을 볼 수있다, 그래서 여기 ... 아니에요?
Sry하지만 Java에서 내 견해를 코딩하고 있습니다. 이유는 XML로 표현할 수 없기 때문입니다. – user1173126
Btw, 나는 "setImageRessource"로 시도하고 동일한 문제가 있습니다. – user1173126
setScaleType을 사용해 보셨습니까? 내 ImageButton에 대한 문제를 해결하는 scaleType – Janusz