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 ..
Category : android-layout
My app uses a regular toolbar with a drawer for navigation. It consists of fragment replacing to display different views while utilizing a single activity. However, when I try to display content using any fragment it overlaps with my toolbar. What I have done to fix this is set the margin-top of all my fragments ..
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 ..
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 ..
I’d like to draw this path in Android: So far I got only the triangle but I also need the arc stuff and I could not figure how to do it. Here is my actual code (only triangle without the rounded corner): Path().apply { moveTo(14f * density, 0f) lineTo(20f * density, 40f * density) lineTo(0f, ..
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" ..
I would like to add dots below specific dates, anyone knows if it’s possible with the Material Components? Source: Android..
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 ..
I have 4 textviews aligned Horizontally in a Constraint Layout. Now, I am in need of to push the 3rd or 4th view to the next row and align the views from the left as 1st and 2nd view. How can I achieve this? Source: Android..
I have 2 edit text fields one for starting time and one for ending time. And I have written a single java function for time picker for both of the edit text fields. The issue is when I try to set time in the ending time edit text field it sets time to the starting ..
Recent Comments