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;
        }
    }

  • 相关阅读:
    linux系统中ssh部署两台服务器远程免密登录
    R语言绘图常用的颜色组合
    R语言中将矩阵转化为行列的形式
    python中返回列表中元素的索引
    R语言如何读取excel数据
    linux系统中实现网络会话共享功能
    python中求1到100的和(循环变量的和)
    linux系统中创建网络会话
    Java程序的三十个基本规则
    风雨20年:我所积累的20条编程经验
  • 原文地址:https://www.cnblogs.com/xl711436/p/3060779.html
Copyright © 2011-2022 走看看