Good day . Already the second day I am trying to deal with this issue. There should be a list with a different color highlighting the best offer from the default.
But as a result, everything gets in the way. 
What could be the problem ? Adapter code:
@Override public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View view, ViewGroup parent) { DetailInfo detailInfo = (DetailInfo) getChild(groupPosition, childPosition); if (view == null) { LayoutInflater infalInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = infalInflater.inflate(R.layout.child_row, null); } TextView bankName = (TextView) view.findViewById(R.id.bankName); bankName.setText(detailInfo.getName().trim()); TextView dateOfUpdate = (TextView) view.findViewById(R.id.DateofUpdate); dateOfUpdate.setText(detailInfo.getDate().trim()); TextView currencySell = (TextView) view.findViewById(R.id.CurrencySell); currencySell.setTag(childPosition); currencySell.setText(detailInfo.getSell().trim()); TextView currencyBuy = (TextView) view.findViewById(R.id.CurrencyBuy); currencyBuy.setTag(childPosition); currencyBuy.setText(detailInfo.getBuy().trim()); if(detailInfo.isBestBuyDeal()) { currencyBuy.setTextColor(Color.rgb(0,150,0)); } if(detailInfo.isBestSellDeal()) { currencySell.setTextColor(Color.rgb(0,150,0)); } return view; } DetailInfo:
public class DetailInfo implements Comparable<DetailInfo>{ private String name = ""; private String date =""; private String buy = ""; private String sell = ""; private Map.Entry<Boolean,Boolean> bestDeal = null; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getBuy() { return buy; } public void setBuy(String buy) { this.buy = buy; } public String getSell() { return sell; } public void setSell(String sell) { this.sell = sell; } public Map.Entry<Boolean,Boolean> getBestDeal() { return bestDeal; } public void setBestDeal(Map.Entry<Boolean,Boolean> bestDeal) { this.bestDeal = bestDeal; } public Boolean isBestBuyDeal() { return bestDeal.getKey(); } public Boolean isBestSellDeal() { return bestDeal.getValue(); } @Override public int compareTo(DetailInfo another) { return this.getName().compareTo(another.getName()); } }
child_row:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/bankName" android:layout_width="wrap_content" android:layout_height="40dp" android:paddingLeft="50dp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_alignParentTop="true" android:layout_weight="1"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/DateofUpdate" android:layout_weight="1"/> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1"> <TextView android:text="Покупка:" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/BuyAmount" android:layout_weight="1"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/CurrencyBuy" android:layout_alignBottom="@+id/BuyAmount" android:layout_toEndOf="@+id/BuyAmount" android:layout_toRightOf="@+id/BuyAmount" android:layout_weight="1"/> <TextView android:text="Продажа:" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/Sell" android:layout_alignBottom="@+id/CurrencyBuy" android:layout_toRightOf="@+id/CurrencyBuy" android:layout_toEndOf="@+id/CurrencyBuy" android:layout_weight="1"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/CurrencySell" android:paddingLeft="10dp" android:layout_alignBottom="@+id/CurrencyBuy" android:layout_toRightOf="@+id/Sell" android:layout_toEndOf="@+id/Sell" android:layout_weight="1"/> </LinearLayout> Thanks for attention
