android - How to make invisible images visible? -


i developing card game. divide 13 cards each client using server, when divide 13 cards 1st player, 9 cards invisible , remaining 4 visible. want when click 1 image, remaining 9 cards gets visible? how this? - code this:

string str="  "c,a", "c,k", "c,q", "c,j", "c,10", "c,9", "c,8", "c,7", "c,6", "c,5", "c,4", "c,3", "c,2"";  drawcards(str);  private void drawcards(string drawstring) {      string[] separated = msglog.split("\\,");       (int = 2; < separated.length - 1; += 2) {          string symbol = separated[i];         string num = separated[i + 1];         string resourcename = symbol + num;         //symbol , number used image xml file          int resid = getresources().getidentifier(resourcename, "id", getpackagename());         im = (imageview) findviewbyid(resid);         context context = im.getcontext();         cardid = context.getresources().getidentifier(resourcename, "drawable", context.getpackagename());          //9 card invisible                if ( > 10) {             im.setvisibility(view.gone);         }          /*  elseif(x.getvisibility() == visible)         {             x.setvisibility(invisible);         }*/          relativelayout.layoutparams lp = new relativelayout.layoutparams(im.getlayoutparams());         lp.setmargins(counter * 5, 0, 0, 0);//left,right,top,bottom         im.setlayoutparams(lp);         im.setimageresource(cardid);          im.setonclicklistener(this);          counter = counter + 8;      } }  public void onclick(view v) {      final string idasstring = v.getresources().getresourcename(v.getid());      piecetoast = toast.maketext(getapplicationcontext(), idserver, toast.length_short);     mainactivity.this.runonuithread(new runnable() {          @override         public void run() {             piecetoast.show();         }     });  } 

when click card how hide card make visible

you play around visibility , use methode setvisibility(view.visible) , setvisibility(view.gone)


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -