【发布时间】:2015-10-01 15:16:45
【问题描述】:
我正在尝试将图片显示到所有屏幕,当它不在 scrollView 中时一切正常,但是当我将 imageview 放到 scrollview 时,它们显示到屏幕的 60-80%。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/Background">
<include layout="@layout/toolbar"
android:id="@+id/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView7"
android:layout_below="@+id/toolbar"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/scrollView7">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/asana_image"
android:scaleType="centerCrop"
android:background="@color/Transparent"
android:src="@drawable/noimage"
android:layout_centerInParent="true"
android:adjustViewBounds="false" />
<ImageButton
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/videoplay_but"
android:background="@drawable/blue_corn_bg"
android:src="@drawable/video"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="29dp"
android:layout_marginStart="29dp"
android:layout_marginTop="27dp"
android:scaleType="centerInside"
android:padding="18dp" />
<ImageButton
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/sound_but"
android:src="@drawable/sound_image"
android:background="@drawable/blue_corn_bg"
android:layout_alignTop="@+id/videoplay_but"
android:layout_toRightOf="@+id/videoplay_but"
android:layout_toEndOf="@+id/videoplay_but"
android:layout_marginLeft="29dp"
android:layout_marginStart="29dp"
android:scaleType="centerInside"
android:padding="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView55"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="17dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView56" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/textView57"
android:layout_below="@+id/textView55"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:id="@+id/VideoLay"
android:visibility="invisible">
<VideoView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/videoAsana"
android:visibility="visible"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
</RelativeLayout>
在片段中:
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
asana_image.setImageBitmap(myBitmap);
}
我的错误在哪里? 谢谢!!!
【问题讨论】: