Tôi đang tạo một TextView
với mặt dưới có thể kéo được, trong một GridLayout
.Android TextView có thể drawable, thay đổi đệm giữa drawable và text?
Tôi muốn mang bản vẽ đến giữa TextView
; Tôi đã thử với setCompoundDrawablePadding(-75)
và nó chỉ thay đổi vị trí của văn bản.
đang hiện tại:
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);
Làm thế nào tôi có thể thiết lập các văn bản và drawable đến giữa TextView
?
Cảm ơn bạn! Nó giúp. – user1648374
bạn sẽ kết hợp nó như thế nào cho các văn bản khác nhau (ví dụ các ngôn ngữ khác nhau)? – orium