編輯:關於Android編程
一行代碼搞定:
mScrollView.fullScroll(ScrollView.FOCUS_DOWN);
源碼中實現該功能的兩個重要方法:
public boolean fullScroll(int direction) { boolean down = direction == View.FOCUS_DOWN; int height = getHeight(); mTempRect.top = 0; mTempRect.bottom = height; if (down) { int count = getChildCount(); if (count > 0) { View view = getChildAt(count - 1); mTempRect.bottom = view.getBottom() + mPaddingBottom; mTempRect.top = mTempRect.bottom - height; } } return scrollAndFocus(direction, mTempRect.top, mTempRect.bottom); }
scrollAndFocus
private boolean scrollAndFocus(int direction, int top, int bottom) { boolean handled = true; int height = getHeight(); int containerTop = getScrollY(); int containerBottom = containerTop + height; boolean up = direction == View.FOCUS_UP; View newFocused = findFocusableViewInBounds(up, top, bottom); if (newFocused == null) { newFocused = this; } if (top >= containerTop && bottom <= containerBottom) { handled = false; } else { int delta = up ? (top - containerTop) : (bottom - containerBottom); doScrollY(delta); } if (newFocused != findFocus()) newFocused.requestFocus(direction); return handled; }
Builder模式是一種設計模式,最初被介紹於《設計模式:可復用面向對象軟件的基礎》,目前在Java及Android中用處更是十分廣泛,因此基本的了解與學習應當掌握。一.
經過前面幾篇文章的分析,我們了解到了Google原生是如何拆分apk的,並且我們自己可以通過解析manifest文件,通過創建插件ClassLoader,Resource
這幾天對Android中實現畫圓弧及圓弧效果中所實現的效果進行了修改,改為進度圓心進度條,效果如圖所示TasksCompletedView.java 代碼如下import
1、概述Android提供了幾種動畫類型:View Animation 、Drawable Animation 、Property Animation 。View An