Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. // draw word buttons
  2.  
  3. RelativeLayout wordLayout = (RelativeLayout) findViewById(R.id.wordlayout);
  4. String[] word = ld.getLevelSpecific().getProcessedWord();
  5. for (int i = 0; i < word.length; i++) {
  6. Button temp = new Button(this);
  7. temp.setText("");
  8. temp.setTypeface(null, Typeface.BOLD);
  9. temp.setTextSize(TypedValue.COMPLEX_UNIT_SP, isd.getWordTextSize());
  10. temp.setIncludeFontPadding(false);
  11. temp.setId(idCount * 2 + i);
  12. temp.setTag(Integer.valueOf(i));
  13. temp.setBackgroundResource(R.drawable.button_shape_letter);
  14. RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
  15. (int) (isd.getWordButtonSize() * orm.getScaleRatio()-2),
  16. (int) (isd.getWordButtonSize() * orm.getScaleRatio()+6*orm.getScaleRatio()));
  17.  
  18.  
  19. if (i > 0) {
  20. p.addRule(RelativeLayout.RIGHT_OF, idCount * 2 + i - 1);
  21. } else {
  22. p.addRule(RelativeLayout.ALIGN_PARENT_TOP);
  23. p.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
  24. }
  25.  
  26. p.setMargins(isd.getExtraspaceWord()+1, isd.getExtraspaceWord(),
  27. isd.getExtraspaceWord()+1, isd.getExtraspaceWord());
  28. temp.setLayoutParams(p);
  29. bWord[i] = temp;
  30. temp.setOnClickListener(new OnClickListener() {
  31.  
  32. @Override
  33. public void onClick(View v) {
  34.  
  35. onWordPressed((Integer) v.getTag());
  36.  
  37. }
  38. });
  39. wordLayout.addView(temp);
  40. }
  41.  
  42. <RelativeLayout
  43. android:id="@+id/wordlayout"
  44. android:layout_width="match_parent"
  45. android:layout_height="0dp"
  46. android:layout_weight="0.2"
  47. android:background="@color/background_game_light_1"
  48. android:gravity="center_horizontal|center_vertical"
  49. android:layoutAnimation="@anim/layout_animation_row1_left_slide"
  50. android:persistentDrawingCache="animation|scrolling"
  51. android:scrollHorizontally="false" >
  52. </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement