Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TableRow tr = new TableRow(this);
- tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT));
- tr.setId(x);
- TextView bookTextView = new TextView(this);
- TextView borrowedTextView = new TextView(this);
- TextView dueDateTextView = new TextView(this);
- TextView numRenewalsTextView = new TextView(this);
- bookTextView.setText("hey");
- bookTextView.setLayoutParams(new TableRow.LayoutParams(44 , TableRow.LayoutParams.WRAP_CONTENT));
- bookTextView.setSingleLine(false);
- borrowedTextView.setText("hey");
- borrowedTextView.setLayoutParams(new TableRow.LayoutParams(78 , TableRow.LayoutParams.WRAP_CONTENT));
- borrowedTextView.setSingleLine(false);
- dueDateTextView.setText("hey");
- dueDateTextView.setLayoutParams(new TableRow.LayoutParams(72 , TableRow.LayoutParams.WRAP_CONTENT));
- dueDateTextView.setSingleLine(false);
- numRenewalsTextView.setText("hey");
- numRenewalsTextView.setLayoutParams(new TableRow.LayoutParams(119 , TableRow.LayoutParams.WRAP_CONTENT));
- numRenewalsTextView.setSingleLine(false);
- Button b1 = new Button(this);
- Button b2 = new Button(this);
- b1.setText("Renew");
- b2.setText("Return");
- b1.setTag("Renew" + x);
- b2.setTag("Return" + x);
- b1.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View v){
- int duration = Toast.LENGTH_LONG;
- Toast.makeText(getApplicationContext(), v.getTag().toString() ,duration).show();
- }
- });
- b2.setOnClickListener(new View.OnClickListener(){
- @Override
- public void onClick(View v){
- int duration = Toast.LENGTH_LONG;
- Toast.makeText(getApplicationContext(), v.getTag().toString() ,duration).show();
- }
- });
- b1.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
- b2.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
- tr.addView(bookTextView);
- tr.addView(borrowedTextView);
- tr.addView(dueDateTextView);
- tr.addView(numRenewalsTextView);
- LinearLayout actions = new LinearLayout(this);
- actions.setLayoutParams(new TableRow.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, 140));
- actions.setOrientation(LinearLayout.VERTICAL);
- actions.addView(b1);
- actions.addView(b2);
- tr.addView(actions);
- tl.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement