<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/titleImageViewID"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/todo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/mac" />
<View
android:id="@+id/view8"
android:layout_width="0dp"
android:layout_height="86dp"
android:layout_marginTop="168dp"
android:background="#8A474141"
app:layout_constraintBottom_toBottomOf="@id/titleImageViewID"
app:layout_constraintEnd_toEndOf="@+id/titleImageViewID"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="@+id/titleImageViewID"
app:layout_constraintTop_toTopOf="@+id/titleImageViewID" />
<TextView
android:id="@+id/titleTextViewID"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="@string/textview"
android:textColor="@android:color/white"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/view8"
app:layout_constraintEnd_toEndOf="@+id/view8"
app:layout_constraintStart_toStartOf="@+id/view8"
app:layout_constraintTop_toBottomOf="@+id/titleImageViewID"/>
</androidx.constraintlayout.widget.ConstraintLayout>
Above code is sample_layout
of a RecyclerView - please suggest for only ConstraintLayout
, I use this layout because this is responsive to any device, so I don't need to create another layout for different screen sizes
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private RecyclerView recyclerView;
private RecycleAdapter recycleAdapter;
private RecyclerView.LayoutManager manager;
private ConstraintLayout constraintLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
recyclerView = findViewById(R.id.recycleViewID);
manager = new ConstraintLayout(this,ConstraintLayout,View.SCROLL_AXIS_HORIZONTAL,false);
RecycleModel [] myThumbData = new RecycleModel[]{
new RecycleModel("Goru banaisi", R.drawable.mac)};}
Can't figure out the main java code how do I access all of my XML in java code, anyone give me a proper code and explanation, I couldn't find any recycler view using constraint layout online. So problem solver help me to solve my problem**