0
点赞
收藏
分享

微信扫一扫

在邮件中添加图片附件以及图片不能适用整个屏幕


Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getResources().getString(R.string.emlSendToFriendSubject)); 
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{emailto}); 
emailIntent.setType("text/plain"); 
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,getResources().getString(R.string.emlSendToFriendBody)); 
File file = getFileStreamPath(EMAIL_TEMP_FILE); 
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); 
emailIntent.setType("image/jpeg"); 
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+file.getAbsolutePath())); 
startActivityForResult(Intent.createChooser(emailIntent, getResources().getString(R.string.btnSendToFriend)),ActMain.EMAIL_DONE);

2.


<ImageView   xmlns:android="http://schemas.android.com/apk/res/android"> 
        android:id='@+id/splash_medium' 
 
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent"  
 
        android:src="@drawable/wallpaper320x480" 
         />


我在ImageView 中有个图片是320*480 和整个屏幕的大小一样

可是竟然不能填满整个屏幕 那么需要设置android:scaleType="fitXY",这是因为可能我们的像素不够,没有告知系统怎么伸展这个图片。

不过要注意android:scaleType="fitXY",是要和 android:src一起使用的 而不是和android:background。

因为android:background默认已经知道了是fitXY。

有时候上面两个属性我们都需要,这是因为我们需要给图片加一个相框,那么这个相框呢我们使用android:background

而我们的图片可以使用android:src。

举报

相关推荐

0 条评论