Java 如何从片段引用适配器类中的子视图
我有childblog.xmlJava 如何从片段引用适配器类中的子视图,java,android,Java,Android,我有childblog.xml <TextView android:id="@+id/tv_fab1" adroid:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="15dp" android:text=
<TextView
android:id="@+id/tv_fab1"
adroid:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="Google+"
android:textColor="@color/white"
android:textSize="16dp"
/>
我试图在我的片段中引用childblog的文本视图,其中包含了recycleview
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_blog, container, false);
System.out.println("Current Class===>>>" + getClass().getSimpleName());
((MainActivity) getActivity()).enable_imv_drawer_mainactivity();
tv_fab1 = (TextView) container.findViewById(R.id.tv_fab1);
我得到了一个空的对象引用。如何在片段中获取childblog的文本视图 变化
tv_fab1 = (TextView) container.findViewById(R.id.tv_fab1);
到
tv_fab1 = (TextView) container.findViewById(R.id.tv_fab1);
tv_fab1 = (TextView) view.findViewById(R.id.tv_fab1);