編輯: 解決了! Awnser 1.不能推/投它如何使閉幕信用頁 - 在顯示尺寸下無需剪切動畫的TableLayout
我想弄清楚幾個小時什麼是做「閉幕式信用」活動的最佳方式。現在我在RelativeLayout
的內部有一個TableLayout
來居中表格。 我使用一個簡單的動畫文件:
<translate
android:duration="20000"
android:fromYDelta="100%p"
android:toYDelta="-100%p" />
的問題是,學分表比屏幕更大,大約4倍大 所以表被削減的屏幕尺寸。動畫工作正常,但只有表格的可見部分遍歷顯示。
是否有更智能的方法來創建結算信用?在android中可以不顯示尺寸切割表嗎?
也許這是太多的文字呢? (與ScrollView
我得到「查看太大,以適應繪圖緩存」)
編輯: 隨着Luksprog的幫助,我得到了整個表scrolldown。就像已經提到的那樣,現在速度很快。現在我遇到了一些問題,通過處理程序或時間任務來控制速度。由於顯示和使表滾動,我在網絡這個解決方案中發現,否則就沒有滾動:
public class Credits extends Activity {
int mesuredHeightScroll;
ScrollView scroll;
boolean first_time = true;
protected void onCreate(Bundle savedInstanceState) {
if (first_time == true) {
super.onCreate(savedInstanceState);
setContentView(R.layout.credits);
scrolldownthetable();
}
}
private void scrolldownthetable() {
// TODO Auto-generated method stub
final ScrollView scroll = (ScrollView) findViewById(R.id.scrolltable);
TableLayout table = (TableLayout) findViewById(R.id.table);
OnGlobalLayoutListener listener = new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
scroll.smoothScrollTo(0, mesuredHeightTable);
}
};
table.getViewTreeObserver().addOnGlobalLayoutListener(listener);
};
/**
* Draw the Layout, otherwise getMesuredHeight returns 0, null onCreate
* to call it again, first time to false, so onCreate doesn't call again on
* focus change (resume,pause...)
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
ScrollView scroll = (ScrollView) findViewById(R.id.scrolltable);
TableLayout table = (TableLayout) findViewById(R.id.table);
mesuredHeightTable = table.getMeasuredHeight();
mesuredHeightScroll = scroll.getMeasuredHeight();
onCreate(null);
first_time = false;
}
}
反正有沒有得到這個scrollTo()的Globallayoutlistener內全自動的嗎? 或者是我的代碼愚蠢和theres更舒適的方式? 這將是巨大的,如果有人可以幫助我的一些代碼,因爲我的時間不多了:/
當我設置scroll.smoothScrollTo(int,int); x和y整數應該是什麼樣的?當我在屏幕底部添加一個視圖時,就足夠了,導致我的桌子比屏幕大4倍。 thx – eyjin
@eyjin'x'將爲0,'y'爲'ScrollView'中所有視圖高度的總和('view.getMeasuredHeight()'),不包含最後添加的空視圖。 – Luksprog
嘿Luksprog,也許你可以幫我用我貼的新代碼?謝謝你到目前爲止 – eyjin