常见问题

143 阅读1分钟

一、SeekBar去除左右内边距 android:paddingStart=”0dp” android:paddingEnd=”0dp”

二、 collapsingToolbarLayout设置滑动与不滑动

private AppBarLayout.LayoutParams mAppBarParams;
private void setAppBarLayoutScrollable(boolean enable) {

setAppBarLayoutScrollable(boolean enable) {  
   if (mAppBarParams == null) {
        mAppBarParams = (AppBarLayout.LayoutParams) collapsingToolbarLayout.getLayoutParams();
    }
    if (enable) {
        mAppBarParams.setScrollFlags(SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
        collapsingToolbarLayout.setLayoutParams(mAppBarParams);
    } else {
        mAppBarParams.setScrollFlags(SCROLL_FLAG_NO_SCROLL);
        collapsingToolbarLayout.setLayoutParams(mAppBarParams);
    }
    
}

3、Activity启动之SingleTask--onNewIntent的用法

第一次走onCreate,栈中存在实例,调用startActivity,只会走onNewIntent,接受数据如下

public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	onNewIntent(getIntent())
}

protected void onNewIntent(Intent intent) {
	super.onNewIntent(intent);
	setIntent(intent);//must store the new intent unless getIntent() will return the old one
	processExtraData()
}

private void processExtraData(){
	Intent intent = getIntent();
}

4、获取应用签名值 命令指令 keytool -v -list -keystore *.jks

5、.gitignore 不生效的解决方案

{
	git rm -r --cached .
	git add .
	git commit -m "update .gitignore"
}