Category : android-layout

I have next structure RecyclerView ConstraintLayout CardView ConstraintLayout ImageView TextView TextView vm = ViewModelProvider(this)[CatalogViewModel::class.java] vm.getList().observe(this, Observer { dataView = findViewById(R.id.dataList) adapter = CatalogRecycleViewAdapter(this, it.data.data) dataView.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false); dataView.adapter = adapter; }) And if i have 2 or more items width different height its get an empty space in a collumn. How to ..

Read more

The intended layout shall be a grid layout of individual items which are broken into sections by a horizontal divider and a caption. (One might thinkg of the gallery view of Google Photos.) The layout shall be scrollable as a whole. The following figure illustrates a mockup. On the left one can see the whole ..

Read more

Is anyone aware of any problems with using sp units for layout dimensions? So, say I have a 16sp text, is there any problem with setting TextView height to 20sp for example, so it scales with the text? <TextView android:textSize="16sp" android:layout_width="match_parent" android:layout_height="20sp" … This way the padding around the text stays proportional to text size ..

Read more

I want to center align the text in the extended floating action button but I’m not able to do that. As you can see in the image below the text is not centrally aligned. Here’s is the code for extended floating action button: <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton android:id="@+id/compress_start_fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:text="S" app:backgroundTint="?android:colorAccent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" android:textColor="@color/textColorPrimaryDark" app:layout_constraintStart_toStartOf="parent" android:textAlignment="center" ..

Read more

I have a ScrollView that contains a TextView which is fetched dynamically from a data base. If the text is small in length, I want my ScrollView layout_height to wrap content, however if the text length is big, I want the ScrollView layout_height to be fixed to a certain value (such as 200dp). Is there ..

Read more