android备忘

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,刷新一下就可以了


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yangchuan_csdn91

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值