带有Google Nexus 5中的wrap_content问题的ImageView

时间:2014-06-04 09:18:12

标签: android-imageview nexus-s

XML代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

</LinearLayout>

活动代码

private ImageView imageView;
private AQuery aQuery;
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);                    
  setContentView(R.layout.activity_main);
  imageView = (ImageView)findViewById(R.id.imageView);
  aQuery = new AQuery(this);
  aQuery.id(imageView).image("http://www.mycadizapp.com/images/sobipro/entries/579/img_canillos_01.jpg",true,true);
}

I simply try to load image from given url using AndroidQuery,it always show smaller image instead of is actual size and this happens only in Google Nexus 5.

1 个答案:

答案 0 :(得分:1)

I found solution for my question just change following properties of ImageView and it's works fine.

<ImageView
  android:id="@+id/imageView"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:adjustViewBounds="true"/>