2016-04-28 59 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) } 
     } 

    }