zoukankan      html  css  js  c++  java
  • 13_全屏


    import android.os.Bundle;
    import android.app.Activity;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MotionEvent;
    import android.view.View;
    import android.view.Window;
    import android.view.WindowManager;
    import android.view.View.OnTouchListener;
    import android.widget.TextView;

    public class MainActivity extends Activity implements OnTouchListener {
        StringBuilder builder = new StringBuilder();
        TextView textView;

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
           
             //设置全屏
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
           
           
            textView = new TextView(this);
            textView.setText("Touch and drag (one finger only)!");
            textView.setOnTouchListener(this);
            setContentView(textView);
        }

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            builder.setLength(0);
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                builder.append("down, ");
                break;
            case MotionEvent.ACTION_MOVE:
                builder.append("move, ");
                break;
            case MotionEvent.ACTION_CANCEL:
                builder.append("cancle, ");
                break;
            case MotionEvent.ACTION_UP:
                builder.append("up, ");
                break;
            }
            builder.append(event.getX());
            builder.append(", ");
            builder.append(event.getY());
            String text = builder.toString();
            Log.d("TouchTest", text);
            textView.setText(text);
            return true;
        }
    }

  • 相关阅读:
    Jetty开发指导:WebSocket介绍
    Python处理JSON
    聚焦数据可视化之中的一个--沃尔马怎样利用数据可视化依据实时社交数据调整採购和仓储计划?
    刚刚在寻找微博
    2010级信管毕业生实习总结汇编版(共29份)
    推荐杀毒软件
    Windows Server 2008 R2 下载地址
    在myeclipse中使用log4j记录日志
    获取Tomcat更详细的日志
    java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileItemFactory
  • 原文地址:https://www.cnblogs.com/xl711436/p/3060779.html
Copyright © 2011-2022 走看看