Click here to Skip to main content
16,017,297 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is how i have added textview by clearing the tableLayout child . . .
from this
C++
Tv.setTextColor(Color.WHITE);
Tv.setGravity(Gravity.CENTER);
Tv.setText(mStandingLts.get(i).getPosition());
taRow.addView(Tv);

to this :
C++
((TextView) (tr).getChildAt(1)).setText(finalMStandingLts.get(i).getTeam());

..Now my question is how to add this
C++
*mTeamL = new LinearLayout(ctx);
ImageView mTeamImage = new ImageView(ctx);
TextView Tv1 = new TextView(ctx);
TableRow.LayoutParams dimParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dimParams.setMargins(16, 16, 16, 16);
//  taRow.setLayoutParams(dimParams);
mTeamL.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams viewDimen = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
Tv1.setLayoutParams(viewDimen);
LinearLayout.LayoutParams viewDimen1 = new LinearLayout.LayoutParams(64,48);
mTeamImage.setLayoutParams(viewDimen1);
Picasso.with(ctx).load(mStandingLts.get(i).getTeamLogo()).into(mTeamImage);
Tv1.setTextColor(Color.WHITE);
Tv1.setGravity(Gravity.CENTER);
Tv1.setText(mStandingLts.get(i).getTeam());
mTeamL.addView(mTeamImage);
mTeamL.addView(Tv1);
taRow.addView(mTeamL);

to dynamically that how i add textview by getting the position.....

If u provide code that would be preferable .. .
Posted
Updated 12-Jan-16 20:51pm
v2
Comments
Sergey Alexandrovich Kryukov 13-Jan-16 2:10am    
Not clear. And I failed to imagine any non-linear layout in a table row. Could you enlighten on that? :-)
—SA
CrimeKumar66 13-Jan-16 5:10am    
ya sure.this is my code where i have added imageview and textview inside LinearLayout.

mTeamL = new LinearLayout(ctx);
ImageView mTeamImage = new ImageView(ctx);
TextView Tv1 = new TextView(ctx);
TableRow.LayoutParams dimParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
dimParams.setMargins(16, 16, 16, 16);
// taRow.setLayoutParams(dimParams);
mTeamL.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams viewDimen = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
Tv1.setLayoutParams(viewDimen);
LinearLayout.LayoutParams viewDimen1 = new LinearLayout.LayoutParams(64,48);
mTeamImage.setLayoutParams(viewDimen1);
Picasso.with(ctx).load(mStandingLts.get(i).getTeamLogo()).into(mTeamImage);
Tv1.setTextColor(Color.WHITE);
Tv1.setGravity(Gravity.CENTER);
Tv1.setText(mStandingLts.get(i).getTeam());
mTeamL.addView(mTeamImage);
mTeamL.addView(Tv1);
taRow.addView(mTeamL);

Now want to do this for different data . .jus by clearing the old data inside this lineaarLayout..

For textview i have done...(see my question) ..for this i dono how to do that..Pls help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900