1

AGridViewにはBaseAdapter、その子に値を設定する責任がある派生クラスがあります。それは正常に動作します。

GridViewスッキリしたら何とかしたいです。つまり、「addOnRefreshListner()」というメソッドがあればいいのにと思います。

API レベル 8 (Froyo) まで対応する必要があります。

4

3 に答える 3

0

カスタムアダプタでBaseAdapter.notifyDataSetChanged()をオーバーライドするとどうなりますか?

@Override
public void notifyDataSetChanged() {
    super.notifyDataSetChanged();
    // A change has happened and caused the GridView to refresh
}
于 2012-08-28T19:21:54.243 に答える
0

notifyDataSetChanged() addOnRefreshListener()がない場合の解決策です。

于 2012-08-28T19:28:11.130 に答える
0

API11以降のを実装してみてくださいView.OnLayoutChangeListener()

View myView = findViewById(R.id.my_view);
myView.addOnLayoutChangedListener(new OnLayoutChangeListener() {

@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {

      // Do what you need to do with the height/width since they are now set
    }
});
于 2012-08-28T19:29:24.953 に答える