android备忘 本是古典 何须时尚 2022-06-03 05:07 308阅读 0赞 1.关于华为荣耀收链接androidStudio调试的问题 在手机设置中找到关于手机,点击手机版本号,会提示还有几次开启开发人员选项,然后返回设置中找到开发人员选项,打开USB连接调试。 2.android Studio运行程序到手机时报错:Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest version) 解决方法,将setting中的Instant Run的所有选项去掉,重新运行。 3.关于android启动页黑白屏的问题处理 在res/values/styles.xml文件中添加自定Theme <style name="ThemeSplash" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:background">@mipmap/page0</item> <item name="android:windowNoTitle">true</item> <item name="android:windowFullscreen">true</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> 在manifest中配置activity的theme为自定义 <activity android:name="activity.SplashActivity" android:screenOrientation="portrait" android:theme="@style/ThemeSplash"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 在activity中添加延时任务 protected void onCreate( Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash ); new Handler().postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(SplashActivity.this, MainActivity.class); startActivity(intent); finish(); } }, 2000); } 4.关于android自定义控件的使用注意,在xml中引用的时候一定要带上APP的包名,否则会出现findviewById为null。 5.关于导入ButterKnife的操作,在APP的gradle中添加 compile 'com.jakewharton:butterknife:7.0.1' 然后点击右上角的gradle,刷新一下就可以了 ![Image 1][] [Image 1]:
还没有评论,来说两句吧...