2013-10-25 48 views
2

我想在可展開列表視圖中向上滑動向下滑動動畫。當我點擊組件項時,它將展開子視圖並將其摺疊。在獲取子視圖方法中,我填充了子視圖。android展開式列表視圖爲子視圖向下滑動動畫

下面的代碼來填充子視圖。

public View getChildView(int groupPosition, int childPosition, 
     boolean isLastChild, View convertView, ViewGroup parent) { 
    Log.i(TAG, "getChildView"); 
    if (convertView == null) { 
      LayoutInflater layoutInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
      convertView = layoutInflater.inflate(R.layout.child, null); 
    } 
    View toolbar = convertView.findViewById(R.id.toolbar); 
    setAnimationView(toolbar); 
    ((LinearLayout.LayoutParams) 
toolbar.getLayoutParams()).bottomMargin = -75; 
    toolbar.setVisibility(View.GONE); 
    ExpandAnimation expandAni = new ExpandAnimation(toolbar, 1000); 
    toolbar.startAnimation(expandAni); 
    TextView tv = (TextView) convertView.findViewById(R.id.childTo); 
    tv.setText(text); 
    return convertView; 
} 

我怎樣才能解決我的problem.please幫助... 感謝&問候, Venkatesan.R

+0

嘿,你有沒有找到解決問題的辦法? – Swayam

+0

嗨Swayam,我正在使用gridview的日曆,現在我已經實現了左右滑動手勢監聽器,所有工作都很好,但是使用onsingletapconfirmed我無法獲得在griview中選定項目的位置。它保留在Gridview中所有選定項目上的位置0。我試着用下面的代碼 int j = gridview.pointToPosition((int)event.getX(),(int)event.getY()); 請幫我解決問題。 –

+0

其實我甚至在尋找類似的動畫,並最終使用https://github.com/tjerkw/Android-SlideExpandableListView/。我不知道如何獲得點擊的位置。 – Swayam

回答

0

ListView類的性能只是在時間繪圖做出了行的大量同時滑動。所以動畫不是這種觀點的目標,也不是那麼容易。
也許像android:animateLayoutChanges="true"可以工作。
你也可以看看這裏:link