華為打開(kāi)logcat
手機(jī): 撥號(hào)界面輸入:*#*#2846579#*#*
平板: 打開(kāi)自帶計(jì)算器輸入 ()()2846579()()= 注意,平板要變橫屏才能出現(xiàn)括號(hào),豎屏是沒(méi)有的.
所有界面右下角浮動(dòng)一個(gè)標(biāo)識(shí)
在baseactivity的onCreate方法中,setContentview之后:
ViewGroup container = (ViewGroup) findViewById(android.R.id.content);
View view = View.inflate(this,R.layout.label,null);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
view.setLayoutParams(params);
container.addView(view);
viewpager 禁止和允許左右滑動(dòng),且可以通過(guò)setCurrentItem來(lái)切換
網(wǎng)上搜出的大多數(shù)都不能用.下面是親測(cè)能用的
public class MyViewPager extends ViewPager {
private boolean isCanScroll = true;
public MyViewPager(Context context) {
super(context);
}
public MyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return this.isCanScroll && super.onTouchEvent(event);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return this.isCanScroll && super.onInterceptTouchEvent(event);
}
public boolean canScroll() {
return isCanScroll;
}
public void setCanScroll(final boolean canScroll) {
this.isCanScroll = canScroll;
}
}