Sto creando un TextView
con un drawable al di sotto, in un GridLayout
.TextView Android disegnabile, modifica padding tra disegnabile e testo?
Voglio portare il drawable al centro del TextView
; Ho provato con setCompoundDrawablePadding(-75)
e cambia solo la posizione del testo.
codice attuale:
TextView secondItem = new TextView(this);
GridLayout.LayoutParams second = new GridLayout.LayoutParams(row2, col1);
second.width = halfOfScreenWidth;
second.height = (int) (quarterScreenWidth * 1.5);
secondItem.setLayoutParams(second);
secondItem.setBackgroundResource(R.color.MenuSecond);
secondItem.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, R.drawable.ic_action_new);
secondItem.setText("Text");
secondItem.setCompoundDrawablePadding(-180);
secondItem.setGravity(Gravity.CENTER);
secondItem.setTextAppearance(this, android.R.style.TextAppearance_Large_Inverse);
gridLayout.addView(secondItem, second);
Come posso impostare il testo e disegnabile alla metà del TextView
?
Grazie! Aiuta. – user1648374
come lo combinerai per un testo differente (ad esempio diverse localizzazioni)? – orium