Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // draw word buttons
- RelativeLayout wordLayout = (RelativeLayout) findViewById(R.id.wordlayout);
- String[] word = ld.getLevelSpecific().getProcessedWord();
- for (int i = 0; i < word.length; i++) {
- Button temp = new Button(this);
- temp.setText("");
- temp.setTypeface(null, Typeface.BOLD);
- temp.setTextSize(TypedValue.COMPLEX_UNIT_SP, isd.getWordTextSize());
- temp.setIncludeFontPadding(false);
- temp.setId(idCount * 2 + i);
- temp.setTag(Integer.valueOf(i));
- temp.setBackgroundResource(R.drawable.button_shape_letter);
- RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(
- (int) (isd.getWordButtonSize() * orm.getScaleRatio()-2),
- (int) (isd.getWordButtonSize() * orm.getScaleRatio()+6*orm.getScaleRatio()));
- if (i > 0) {
- p.addRule(RelativeLayout.RIGHT_OF, idCount * 2 + i - 1);
- } else {
- p.addRule(RelativeLayout.ALIGN_PARENT_TOP);
- p.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
- }
- p.setMargins(isd.getExtraspaceWord()+1, isd.getExtraspaceWord(),
- isd.getExtraspaceWord()+1, isd.getExtraspaceWord());
- temp.setLayoutParams(p);
- bWord[i] = temp;
- temp.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onWordPressed((Integer) v.getTag());
- }
- });
- wordLayout.addView(temp);
- }
- <RelativeLayout
- android:id="@+id/wordlayout"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="0.2"
- android:background="@color/background_game_light_1"
- android:gravity="center_horizontal|center_vertical"
- android:layoutAnimation="@anim/layout_animation_row1_left_slide"
- android:persistentDrawingCache="animation|scrolling"
- android:scrollHorizontally="false" >
- </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement