android图片点击全屏
1. 求解 android 图片点击一下就放大到全屏,再点一下就回到原界面,这个android源码谁有呢
package com.pic;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.Bundle;
import android.view.Display;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.widget.ImageView;
public class TestanroidpicActivity extends Activity {
/** Called when the activity is first created. */
Bitmap bp=null;
ImageView imageview;
float scaleWidth;
float scaleHeight;
int h;
boolean num=false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Display display=getWindowManager().getDefaultDisplay();
imageview=(ImageView)findViewById(R.id.imageview);
bp=BitmapFactory.decodeResource(getResources(),R.drawable.icon);
int width=bp.getWidth();
int height=bp.getHeight();
int w=display.getWidth();
int h=display.getHeight();
scaleWidth=((float)w)/width;
scaleHeight=((float)h)/height;
imageview.setImageBitmap(bp);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
if(num==true) {
Matrix matrix=new Matrix();
matrix.postScale(scaleWidth,scaleHeight);
Bitmap newBitmap=Bitmap.createBitmap(bp, 0, 0, bp.getWidth(), bp.getHeight(), matrix, true);
imageview.setImageBitmap(newBitmap);
num=false;
}
else{
Matrix matrix=new Matrix();
matrix.postScale(1.0f,1.0f);
Bitmap newBitmap=Bitmap.createBitmap(bp, 0, 0, bp.getWidth(), bp.getHeight(), matrix, true);
imageview.setImageBitmap(newBitmap);
num=true;
}
break;
}
return super.onTouchEvent(event);
}
}
2. 在Android 开发中怎么全屏显示
全屏显示有两种方法
1:
在onCreate方法里面加上这句代码 requestWindowFeature(Window.FEATURE_NO_TITLE);
2 :
//显示全屏
private void setFullScreen()
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
//[代码] 退出全屏函数:
private void quitFullScreen()
{
final WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().setAttributes(attrs);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
3. Android应用如何全屏显示
要设置Android应用全屏显示有两种方式,第一种是在AndroidManifest.xml文件中进行配置,另一种方式是在Activity中进行设置。此处仅描述第二种方式。 设置全屏显示有两步工作,首先要取消显示标题栏,然后在全屏显示。代码如下:1@Override2publicvoidonCreate(Bundle savedInstanceState) {3super .onCreate(savedInstanceState);4//使屏幕不显示标题栏(必须要在setContentView方法执行前执行)5this .requestWindowFeature(Window.FEATURE_NO_TITLE);6//隐藏状态栏,使内容全屏显示(必须要在setContentView方法执行前执行)7this .getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,8WindowManager.LayoutParams.FLAG_FULLSCREEN);9setContentView(R.layout.splash);10}强调,设置全屏显示时,这两行核心代码一定要在设置视图之前执行,即一定要位于setContentView()方法之前。
4. android webview怎样点击按钮全屏播放
重写以下两个方法:
1.WebChromeClient.onShowCustomView(android.view.View,android.webkit.WebChromeClient.CustomViewCallback) ;
2.WebChromeClient.onHideCustomView()
然后写你的逻辑就可以了