The essence of my question is that it is possible, for example, as in an email client, to place 2 lines one under the other in one cell and at the same time they may have different parameters (font, color, indent, etc.). At the same time, the RecyclerView should be created programmatically, since it is necessary that everything take place on one layer. For example, I pressed the button, the layer is overwritten and the newly created elements are put on it.
Here is the basis of my experiences: There is a code for a simple RecyclerView
using Android.App; using Android.OS; using Android.Support.V7.App; using Android.Runtime; using Android.Widget; using Android.Support.V7.Widget; using Android.Views; namespace recyclerview { [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)] public class MainActivity : AppCompatActivity { public class MyAdapter : RecyclerView.Adapter { string[] items; public MyAdapter(string[] data) { items = data; } // Create new views (invoked by the layout manager) public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { // set the view's size, margins, paddings and layout parameters var tv = new TextView(parent.Context); tv.SetHeight(200); tv.Text = ""; var vh = new MyViewHolder(tv); return vh; } // Replace the contents of a view (invoked by the layout manager) public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { var item = items[position]; // Replace the contents of the view with that element var holder = viewHolder as MyViewHolder; holder.TextView.Text = items[position]; } public override int ItemCount { get { return items.Length; } } } public class MyViewHolder : RecyclerView.ViewHolder { public TextView TextView { get; set; } public MyViewHolder(TextView v) : base(v) { TextView = v; } } //MyAdapter mAdapter; protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); RecyclerView TaskList; // TaskList = new RecyclerView(this); // LinearLayout lin = FindViewById<LinearLayout>(Resource.Id.linearall); // TaskList.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); TaskList = FindViewById<RecyclerView>(Resource.Id.recyclerView); // lin.AddView(TaskList); // Plug in the linear layout manager: var layoutManager = new LinearLayoutManager(this) { Orientation = LinearLayoutManager.Vertical }; TaskList.SetLayoutManager(layoutManager); TaskList.HasFixedSize = true; // var recyclerViewData = GetData(Lister); string[] recyclerViewData = new string[] { "odin", "dva", "tri" }; // Plug in my adapter: MyAdapter mAdapter = new MyAdapter(recyclerViewData); TaskList.SetAdapter(mAdapter); } public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) { Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults); base.OnRequestPermissionsResult(requestCode, permissions, grantResults); } } }
and there is such axml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:id ="@+id/linearall"> <android.support.v7.widget.RecyclerView android:layout_width ="match_parent" android:layout_height ="match_parent" android:scrollbars="vertical" android:id = "@+id/recyclerView" /> </LinearLayout>
Tell me where to dig, what to press