2016-04-28 20 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にRecyclerView.OnScrollListenerを追加することができますし、スクロール上であなたは子供のすべてを反復処理し、画面上の彼らの位置を見つけることができます次のようなもの(コトリンコード):

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) } 
     } 

    } 
関連する問題