开发者

Android: ImageView.ScaleType but for Buttons and/or RadioButtons

I like to use a customized (Radio)Button and I know I can use whatever image for the background with the following code inside the xml:

<RadioButton
...
android:button="@drawable/myDrawable"
../>

However: I want to use three radiobuttons, that fill the whole row. But the drawable that I use for the button, doesnt get resized depending on the sreensize, so if the drawable is too big only parts of it will show, and if it is too small, not the whole screen will be filled. If I would use ImageViews I could change the ScaleType like so:

ImageView myImageView = (ImageView) findViewById(R.id.myimageview);
myImageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); 

But there is no such property for other Views, than the imageView. So ho开发者_开发百科w can I accomplish the same for (Radio)Buttons?


You will have to provide images with different sizes (see Supporting Multiple Screens)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜