2016-04-28 60 views

回答

0

如果您正在使用可穿戴設備,則可以使用WearableListView

如果是這樣,在你的適配器中,你有你的Item類代表你的行。該課程可以實施WearableListView.OnCenterProximityListener。在那裏,你可以動畫的回調您的觀點:一個小例子,而不動畫:

private static class Item extends LinearLayout implements WearableListView.OnCenterProximityListener { 

    private FontTextView label; 

    public Item(Context context) { 
     super(context); 
     View.inflate(context, R.layout.match_center_item, this); 
     label = (FontTextView) findViewById(R.id.label); 
    } 

    @Override 
    public void onCenterPosition(boolean animate) { 
     label.setAlpha(EXPAND_LABEL_ALPHA); 
    } 

    @Override 
    public void onNonCenterPosition(boolean animate) { 
     label.setAlpha(SHRINK_LABEL_ALPHA); 
    } 
} 
0

你可以滾動增加RecyclerView.OnScrollListener您RecyclerView和您可以遍歷所有孩子,並發現他們在屏幕上的位置像(科特林代碼):

for(i in 0..this.childCount){ 
     val view = this.getChildAt(i) 
     when(i){ 
      in 0..this.childCount/2 -1-> {view.scaleX = i.toFloat()/(this.childCount/2) 
             view.scaleY== i.toFloat()/(this.childCount/2) } 
      this.childCount/2 -> {view.scaleX = 1F ; view.scaleY = 1F} 
      else ->{view.scaleX = (this.childCount-i).toFloat()/(this.childCount/2) 
        view.scaleY== (this.childCount-i).toFloat()/(this.childCount/2) } 
     } 

    }