Here is my Layout (fragment_hadees.xml) :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".Hadees">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:id="@+id/myrecyclerview"
android:layout_height="match_parent"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fab"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:elevation="40dp"
android:layout_margin="30dp"
android:backgroundTint="#ffffff"
android:src="@drawable/favorited"/>
</RelativeLayout>
Here is the Hadees.java (root java file) :
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View root = inflater.inflate(R.layout.fragment_hadees, container, false);
((MainActivity) getActivity()).getSupportActionBar().setTitle("Hadees");
HadeesAdapter hadeesAdapter;
fab= root.findViewById(R.id.fab);
ImageView copybutton= root.findViewById(R.id.copybutton);
final TextView textView=root.findViewById(R.id.textView);
ImageView whatsapText=root.findViewById(R.id.whatsApp_txt);
toggleModelList= new ArrayList<>();
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getActivity(), "FAB", Toast.LENGTH_SHORT).show();
}
});
myrecyclerview=(RecyclerView)root.findViewById(R.id.myrecyclerview);
myrecyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
Here is my hadees_contents.xml:
<LinearLayout
android:id="@+id/l1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:textIsSelectable="true"
android:textColor="#000000"
android:gravity="center"
android:maxLines="100"
android:fontFamily="sans-serif-condensed-medium"
android:text="This is Arabic Text"
android:textSize="20sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:background="@android:color/darker_gray" />
<LinearLayout
android:id="@+id/l2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:weightSum="4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/copybutton"
android:src="@drawable/ic_content_copy_black_24dp" />
How can I get Access to the the Views in the hadees_contents.xml in Hadees.java ? I have the access to FAB but not to the contents of Recycler's View inflated layout ,which is hadees_contents.xml