我想显示的image
是fullscreen
:图像不全屏
public class PhotoPleinEcranActivity extends Activity {
private Bundle data;
private ImageView img;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.photo_plein_ecran);
img = (ImageView)findViewById(R.id.zoom);
BitmapFactory.Options bfOptions = new BitmapFactory.Options();
bfOptions.inDither = true; //Disable Dithering mode
bfOptions.inPurgeable = true; //Tell to gc that whether it needs free memory, the Bitmap can be cleared
bfOptions.inInputShareable = true; //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
bfOptions.inTempStorage = new byte[32 * 1024];
data = getIntent().getExtras();
FileInputStream fs = null;
Bitmap bm;
try {
fs = new FileInputStream(new File(data.getString("path")));
if(fs != null) {
bm = BitmapFactory.decodeFileDescriptor(fs.getFD(), null, bfOptions);
img.setImageBitmap(bm);
}
} catch (IOException e) {
} finally {
if(fs != null) {
try {
fs.close();
} catch (IOException e) {
}
}
}
}
}
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="0dip"
android:layout_marginBottom="0dip"
android:paddingTop="0dip"
android:paddingBottom="0dip"
android:orientation="horizontal">
<ImageView
android:id="@+id/zoom"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="0dip"
android:layout_marginBottom="0dip"
android:paddingTop="0dip"
android:paddingBottom="0dip"
/>
</LinearLayout>
清单文件:
<activity
android:name="com.ambre.impots.PhotoPleinEcranActivity"
android:label="@string/galleryPhotos"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
</activity>
在运行时有一灰字段在图像的底部(我用灰色包围了黄色):
那么如何使灰场消失?
尝试添加'机器人:scaleType = “centerCrop”'你'imageView' – hrskrs
尝试'机器人:scaleType = “fitXY”'和'机器人:adjustViewBounds = “真”' –
可能重复[如何显示图像查看全屏在imageView点击?](http://stackoverflow.com/questions/24463691/how-to-show-imageview-full-screen-on-imageview-click) –