xml から取得したテキストビューがあるとします。
final View popupView = getLayoutInflater().inflate(R.layout.popup, null);
final TextView tvPop = (TextView)popupView.findViewById(R.id.tvKeyPop);
しかし、複数のtvPopを持ちたいのですが、どのように複製すればよいですか?
ありがとう。
xml から取得したテキストビューがあるとします。
final View popupView = getLayoutInflater().inflate(R.layout.popup, null);
final TextView tvPop = (TextView)popupView.findViewById(R.id.tvKeyPop);
しかし、複数のtvPopを持ちたいのですが、どのように複製すればよいですか?
ありがとう。
あなたはこれを行うことができます:
TextView cloned = new TextView(getApplicationContext());
cloned.setText(tvPop.getText());
cloned.setLayoutParams(tvPop.getLayoutParams());
...
cloned.setWhateverFieldYouNeedToBeCloned(tvPop().getWhateverFieldYouNeedToBeCloned());
それが役立つことを願っています。