ExpandableListAdapter.getChildView で発生している問題をデバッグしようとしています。
リスト項目の背景に、グラデーションと半径 1 のコーナーを含む形状の Drawable を定義しました。特別なことは何もありません。
次に、私のアダプタ コードでは、getChildView 内に次のスニペットがあります。
GradientDrawable background = (GradientDrawable) convertView.getBackground();
float topRadius = 0;
float bottomRadius = 0;
// Make the corner radius obvious for debugging
if (childPosition == 0)
topRadius = 14;
if (childPosition == (mValues.size() - 1))
bottomRadius = 14;
background.setCornerRadii(new float [] { topRadius, topRadius,
topRadius, topRadius,
bottomRadius, bottomRadius,
bottomRadius, bottomRadius});
convertView.setBackgroundDrawable(background);
ここでの試みは、最初のリスト項目の上部と最後のリスト項目の下部を丸めることです。デバッグを介して、必要なアイテムに必要な値を設定しているように見えます。
しかし、私が抱えている問題は、隅の半径がすべてのリスト項目に対して下の項目であるかのように設定されていることです。
少し余談ですが、少なくともデバッグ目的で、GradientDrawable の角の半径を取得する方法はありますか?
ありがとう、
wTs