android-constraintlayout

Android studio 4 Button on full screen [closed]

百般思念 提交于 2020-06-07 07:36:09
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 months ago . I was beginner in android studio, Can anyone show me the way how to design 4 button cover all the screen 回答1: Try this using ConstraintLayout <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns

ConstraintLayout hides the last line of TextView with app:layout_constrainedHeight=“true”

旧巷老猫 提交于 2020-05-27 13:13:26
问题 The bounty expires in 1 hour . Answers to this question are eligible for a +50 reputation bounty. Nominalista wants to draw more attention to this question. I have noticed weird behavior of ConstraintLayout (version 1.1.3) that hides the last line of TextView whenever I try to use height with wrap_content property and layout_constrainedHeight is set to true . With layout_constrainedHeight : With no layout_constrainedHeight : Source code: <?xml version="1.0" encoding="utf-8"?> <androidx

UI components not visible in TransitionManager animations

让人想犯罪 __ 提交于 2020-05-17 06:26:27
问题 This is an issue in a Java Android application with a very simple custom draggable drawer in MainActivity. This is how it behaves when it runs on Android 10 (API level 29) emulator, and it is the expected behavior. But the problem is, when it runs on Android L (API level 21) emulator, it behaves unexpectedly as follows : During the animation, UI components are not visible. But when app goes to background and comes back, they become visible. Implementation details of app : To detect fling /

How to set a layout width percentage of one third on ConstraintLayout?

坚强是说给别人听的谎言 提交于 2020-05-16 02:27:27
问题 I want to fill the screen in a two-dimensional grid of 3x6 TextViews. This means that each TextView must be 1/3 of the full screen width and the height 1/6 of the full screen height. I am using a ConstraintLayout for this layout, since LinearLayouts are bad practise for this layout as nested weights are bad for performance. Currently, I am using the percentage 0.333333333333333 and 0.166666666666667 for respectively the width and height, as shown below. <TextView app:layout_constraintLeft

How can we add Views dynamically androidx.constraintlayout.helper.widget.Flow and add reference Ids

我与影子孤独终老i 提交于 2020-04-13 04:58:07
问题 How can we add Views dynamically in androidx.constraintlayout.helper.widget.Flow and add reference Ids dynamically. 回答1: Here is Kotlin Implementation for (i in 0..4) { val customView = CustomComponent (this) customView.id = generateViewId() constraintLayout.addView(customView,i) flow.addView(customView) } Following is my XML <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/constraintLayout" app:layout

Android percent screen width in RecyclerView item

冷暖自知 提交于 2020-04-08 19:02:17
问题 How would I get a RecyclerView's item height to be, say, 30% of the screen's height? I can't simply use a ConstraintLayout or a PercentFrameLayout/PercentRelativeLayout, since those position child layouts relative to parent layouts, whose size might not match the screens. Preferably, I'd like to do this in pure XML (and not have to use any Runnables to get the screen height dynamically). EDIT To clarify, since a lot of solutions suggest restraining the height of the RecyclerView, that's not

Android percent screen width in RecyclerView item

耗尽温柔 提交于 2020-04-08 19:01:52
问题 How would I get a RecyclerView's item height to be, say, 30% of the screen's height? I can't simply use a ConstraintLayout or a PercentFrameLayout/PercentRelativeLayout, since those position child layouts relative to parent layouts, whose size might not match the screens. Preferably, I'd like to do this in pure XML (and not have to use any Runnables to get the screen height dynamically). EDIT To clarify, since a lot of solutions suggest restraining the height of the RecyclerView, that's not

How to set maxHeight over DimensionRatio with ConstraintLayout?

十年热恋 提交于 2020-03-19 07:42:09
问题 I'm trying to display an image centered in parent with a dimension ratio of 1220:1000 AND a maximum height of 300dp (to keep the image small even with large screen) <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <com.facebook.drawee.view.SimpleDraweeView android:id="@+id/image" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginStart="10dp" android:layout_marginLeft="10dp" android:layout_marginTop

Simple yet tricky layout using ConstraintLayout

本秂侑毒 提交于 2020-02-24 17:25:57
问题 I am trying to make the following seemingly simple yet tricky layout using ConstraintLayout . Normal UI: With longer title: I have tried following code: <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" android:text="April Ludgate" android

Simple yet tricky layout using ConstraintLayout

廉价感情. 提交于 2020-02-24 17:18:45
问题 I am trying to make the following seemingly simple yet tricky layout using ConstraintLayout . Normal UI: With longer title: I have tried following code: <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp"> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:maxLines="1" android:text="April Ludgate" android