图标边距/填充被破坏

时间:2017-01-27 13:02:07

标签: java android

  

我已经为我的图标创建了一个刷新动画。但是在设定之后   imageResource到布局被破坏的按钮。

enter image description here

  

在创建动画并设置imageResource按钮之前   使用margin / padding看起来像这样:

enter image description here

我已使用以下代码设置imageResource:

public void onItemClick(AdapterView adapterView, View view, int i, long l) {
        //first cancel discovery because its very memory intensive.
        mBluetoothAdapter.cancelDiscovery();

        Log.d(TAG, "onItemClick: You Clicked on a device.");
        String deviceName = mBTDevices.get(i).getName();
        String deviceAddress = mBTDevices.get(i).getAddress();

        Log.d(TAG, "onItemClick: deviceName = " + deviceName);
        Log.d(TAG, "onItemClick: deviceAddress = " + deviceAddress); 

        if(Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) {
            Log.d(TAG, "Trying to pair with " + deviceName);
            for (BluetoothDevice device: mBTDevices){
                if (device.equals("HTC")){
                    device.createBond();
                }
            }

public class MainActivity extends AppCompatActivity implements AdapterView.OnItemClickListener{
    private static final String TAG = "MainActivity";

    BluetoothAdapter mBluetoothAdapter;
    Button btnEnableDisable_Discoverable;

    public ArrayList mBTDevices = new ArrayList();

    public DeviceListAdapter mDeviceListAdapter;

    ListView lvNewDevices;

无法跟踪此问题的原因。任何帮助都非常有价值。

1 个答案:

答案 0 :(得分:0)

检查图标图像是否具有相同的大小。分辨率