0
这里是我的按钮图像文件从我的绘制文件夹,名为ooo.png:按钮与背景图像不显示比例
这是它的外形类似设备上:
正如您所看到的宽度高度比例已更改。它比原来的宽一点。 我需要它看起来一样。
我不明白是什么导致了这种拉伸。这里是我的xml文件:在styles.xml的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
style="@style/styleBtns"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
我styleBtns部分:
<style name="styleBtns" >
<item name="android:background">@drawable/btns_abc</item>
</style>
在我btns_abc我将背景设置为我的图像资源。目前状态下按下和正常状态下都是一样的,我想尽快改变这种状况,因为它工作正常:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/ooo" android:state_pressed="true"></item>
<item android:drawable="@drawable/ooo"></item>
</selector>
谢谢!
使用imageview与图像作为src和背景透明... – Pramod