1
현재 뷰 페이지에서 복사 한 텍스트를 다음 또는 이전 텍스트로 복사 할 때 List.but의 textview에 텍스트를 표시하는 뷰 페이지가 있습니다. textview는 뷰 페이지에서 복사 할 때 다음 또는 이전 텍스트를 복사합니다.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.copyid:
TextView msg= (TextView) viewPager.findViewById(R.id.textView);
String msgs=msg.getText().toString();
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,msgs);
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent,"Share Via"));
break;
}
및 viewpager 어댑터 클래스
: - - : 여기 내 mainactivity 방법 코드@Override
public Object instantiateItem(ViewGroup container, int position) {
LayoutInflater inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout=inflater.inflate(R.layout.viewpager_layour,null);
msg= (TextView) layout.findViewById(R.id.textView);
msg.setText(list.get(position));
((ViewPager) container).addView(layout, 0);
return layout;
}
감사합니다. 완벽한 해결책 – AkashK
@AkashK이 답변으로 도움이되었다고 생각한다면 동의하십시오. –
답변으로 수락했습니다. 감사 – AkashK