Я получил активность с PageViewer
. Шоу PageViewer
с XML с TextView
(«Список1»). Чтобы было легче объяснить, я пытаюсь изменить текст TextView
, но он не меняется, это все еще "List1". Без ошибок нет исключений. Надеюсь, вы мне поможете.
Активность :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_diary_new);
ViewPager vp = findViewById(R.id.viewpagernew);
LayoutInflater factory = getLayoutInflater();
View test = factory.inflate(R.layout.list_1, null);
vp.setAdapter(new CustomListPagerAdapter(this));
TextView tv = test.findViewById(R.id.textView2);
tv.setText("NewText");
}
XML (list_1) :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="List1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>