我试图进入TextView
但Fragment
onCreateView()
它的回报null
。下面是代码片段。
View view1 = inflater.inflate(R.layout.fragment_employee_repotee, container, false);
TextView tv = (TextView) view1.findViewById(R.id.textViewNamere);
tv.setText(EmpDirectoryListingFragment.emp_name);
我得到了电视价值null
。下面是布局的XML。
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="h2h.telenor.com.fragments.TAFListingFragment">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:background="#006400">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e4e4e4">
<LinearLayout
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f1f1f1">
<TextView
android:id="@+id/textViewOpen"
android:paddingTop="10dp"
android:layout_toRightOf="@+id/textViewNamere"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18dp"
android:gravity="center"
android:layout_gravity="center"
android:text="Muhamamd Faisal Shahzad"/>
<ImageView
android:id="@+id/imageViewOpen"
android:layout_alignParentLeft="true"
android:layout_weight="1"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/up_arrow"/>
</LinearLayout>
<ListView
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listViewEmpDownHierarchy"
android:drawSelectorOnTop="true">
</ListView>
</LinearLayout>
</LinearLayout>