各リスト項目にはhorizontal list
、リストビュー内の別のビュー (ボトルオーバーレイ) の高さの特定の割合であると想定される背景塗りつぶしビューがあります。
this questiongetHeight()
で述べたように、ボトルオーバーレイビューの高さが見つからないことを除いて、すべて機能します。提案されているように onGlobalLayout リスナーを使用しようとしましたが、設定時に使用される値に関係なく、すべてのアイテムの塗りつぶしの高さは同じです layoutparams.height
これを行う簡単な方法はありますかbottleheightoverlay
。リスト内の各項目で同じです。
public class ImageAdapter extends BaseAdapter {
// varible declaration...
// getView that displays the data at the specified position in the data set.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
......
......
//increase height of filler
int bottleHeight = gridView.findViewById(R.id.bottleoverlay).getHeight();
FrameLayout backgroundfill = (FrameLayout) gridView.findViewById(R.id.backroundfillbar);
double percent = products.get(position).value/ products.get(0).value;
backgroundfill.getLayoutParams().height = (int) ( (bottleHeight/percent));