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

  • 相关阅读:
    Spring进阶—如何用Java代码实现邮件发送(一)
    如何在Apache中使用PHP处理PHP文件
    最“高大上”的Spring测试:Spring Test
    【编程直播】来约吗?
    【PaPaPa】实现缓存决策
    【PaPaPa】系统架构搭建浅析
    【PaPaPa】集成B/S主流技术的MVC5项目
    【轮子狂魔】手把手教你自造Redis Client
    【轮子狂魔】抛弃IIS,打造个性的Web Server
    【轮子狂魔】抛弃IIS,向天借个HttpListener
  • 原文地址:https://www.cnblogs.com/xl711436/p/3060779.html
Copyright © 2011-2022 走看看