美文网首页
aide安卓编程模板

aide安卓编程模板

作者: 傻傻不知天年 | 来源:发表于2018-12-28 16:50 被阅读0次

    配置文件

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com">
        <application
            android:allowBackup="false"
            android:icon="@drawable/ic_launcher"
            android:label="️"
            android:theme="@style/AppTheme"
            android:resizeableActivity = "true"
            android:hardwareAccelerated="false">
            <activity
                android:name=".MainActivity"
                android:label="️" 
                android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
                android:screenOrientation="landscape">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    </manifest>
    

    java

    package com;
    
    import android.app.*;
    import android.content.*;
    import android.graphics.*;
    import android.os.*;
    import android.view.*;
    import android.widget.*;
    
    public class MainActivity extends Activity 
    {
        int winx,winy;
        mview view;
        //变量和函数
        //////////////////
        class mview extends View{//自定义view
            public mview(Context con){
                super(con);
            }
            @Override
            protected void onSizeChanged(int w, int h, int oldw, int oldh)
            {
                winx=w;winy=h;
                //初始化
            }
            @Override
            protected void onDraw(Canvas canvas)
            {//绘图
            
            }
            @Override
            public boolean onTouchEvent(MotionEvent event)
            {//触控
                if(event.getAction()==MotionEvent.ACTION_DOWN){
                    int x=(int)event.getX(),y=(int)event.getY();
                }
                invalidate();//重绘
                return true;
            }
        }
        //////////////////
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            view=new mview(this);
            setContentView(view);
        }
        @Override
        public boolean onKeyDown(int keyCode,KeyEvent event)
        {
            if(keyCode==KeyEvent.KEYCODE_BACK){
                //返回键
                moveTaskToBack(false);
                return true;
            }
            return super.onKeyDown(keyCode,event);
        }
    }
    

    相关文章

      网友评论

          本文标题:aide安卓编程模板

          本文链接:https://www.haomeiwen.com/subject/fwlelqtx.html