我在android中使用自定义的列表视图。在我的自定义列表视图类Voucherlistcustomization1中,我有一个名为linearlayoutearnloyaltypoints1的线性布局。在外部类凭证中的布局凭证中的另一个布局的onclick上,我需要使布局linearlayoutearnloyaltypoints1可见性消失。但是我没有得到访问外部类中的布局。
public class Voucher extends Activity implements OnClickListener,OnItemClickListener
{
ListView listviewvoucher;
private Voucherlistcustomization1 vouchertextadapter=null;
public ArrayList<String>Addelemntstovoucher = new ArrayList<String>();
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.voucher);
Addelemntstovoucher.add("SHOPPER STOP");
Addelemntstovoucher.add("Expire date:5-8-2012");
if(vouchertextadapter == null)
{
vouchertextadapter=new Voucherlistcustomization1(this,0, Addelemntstovoucher);
}
listviewvoucher.setAdapter(vouchertextadapter);
Log.d("customerfaname",""+Addelemntstovoucher);
listviewvoucher.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> a, View v, int position,long id)
{
Log.d("Clicked","bbbbbbbbbbbbbbbbbb"+a);
}
});
}
@Override
public void onClick(View v)
{
if(v==linearlayout_Voucher_to_Grab){
linearlayoutearnloyaltypoints1.setVisibility(View.GONE) ;
}
}
public class Voucherlistcustomization1 extends ArrayAdapter<String>
{
LinearLayout linearlayoutearnloyaltypoints1;
public Voucherlistcustomization1(Context context, int textViewResourceId,List<String> objects)
{
super(context, textViewResourceId,objects);
}
public View getView(int position, View convertView, ViewGroup parent)
{
if(convertView == null)
{
convertView = LayoutInflater.from(getContext()).inflate(R.layout.customized_listview_for_voucher, null);
}
linearlayoutearnloyaltypoints1=(LinearLayout)findViewById(R.id.linearlayoutearnloyaltypoints1);
//components present in the customized_listview_for_voucher layout
String text1 = getItem(position);
TextView textView1 = (TextView) convertView.findViewById(R.id.textview1);
textView1.setText(text1);
String text2 = getItem(position);
TextView textView2 = (TextView) convertView.findViewById(R.id.textView2);
textView2.setText(text2);
String text3 = getItem(position);
TextView textView3 = (TextView) convertView.findViewById(R.id.textView3);
textView3.setText(text3);
return convertView;
}
}
}
My issue here is that on the Onclick of :
(v==linearlayout_Voucher_to_Grab)
{
linearlayoutearnloyaltypoints1.setVisibility(View.GONE) ;
}
I am trying to make the layout linearlayoutearnloyaltypoints1.setVisibility(View.GONE) ; visibity to gone however the layout(linearlayoutearnloyaltypoints1) is a component in the class Voucherlistcustomization1 in the Inner class Voucherlistcustomization1.Can someone please tell me how do i set the visibity of that layout to false.