android-constraintlayout

Align top two textviews with different font sizes

假如想象 提交于 2019-12-11 01:18:14
问题 Im using constraint layout and i want to achieve the following: The app:layout_constraintBaseline_toBaselineOf attribute bottom aligns the two textviews, is there any way to top align the two? The regular app:layout_constraintTop_toTopOf is not working of course because of the size differences. 回答1: So it seems there is no a convenient way of doing this and a custom view must be implemented. I've taken inspiration from here: https://github.com/fabiomsr/MoneyTextView 回答2: Try this . <?xml

TransitionListener callbacks not called when there is nothing to change

瘦欲@ 提交于 2019-12-10 22:19:03
问题 I'm animating between scenes using the TransitionManager and constraint sets using the following code. val transition = AutoTransition() transition.addListener(object : Transition.TransitionListener { override fun onTransitionEnd(transition: Transition) { // do something } }) val constraintSet = ConstraintSet() constraintSet.clone(this, R.layout.frame_loading) TransitionManager.beginDelayedTransition(rootLayout, transition) constraintSet.applyTo(rootLayout) There's something I want to do when

How to refresh height of a Constrained View in ConstraintLayout

…衆ロ難τιáo~ 提交于 2019-12-10 21:53:41
问题 I have a ConstraintLayout in which i have a View(called Bar) and a RecyclerView Constrained to The Bottom of The Bar, The RecyclerView has it's height set to match Constraint(0dp), So if in The Android Layout Editor i move up The Bar for example, The RecyclerView height increase and is always "anchored" To The Bar, it's work, But This is Not the same behavior at runtime, when i move the Bar(with an onTouchListener), The RecyclerView height does not change at all and stay like if the Bar was

How to mimick Weighted LinearLayout with a Constraint Layout

断了今生、忘了曾经 提交于 2019-12-10 21:15:21
问题 How can we spare space equally in a Constraint Layout as in LinearLayout? For instance, how would the below layout become if it was written with constraints? <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal"> <TextView android:id="A" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> <TextView android:id="B" android:layout_width="0dp" android:layout_height="wrap_content" android

ConstraintLayout relative distance in percentage %

ⅰ亾dé卋堺 提交于 2019-12-10 20:46:16
问题 I am working with ConstraintLayout and I want to set a percentage margin top to the Textview Sample from the Button 2 placed at 52% of the screen. 3% is of course compared to the height of the screen. The position should be relative from another UI components, guidelines reference only from the top (or bottom) of the screen It's possible to do this exclusively via xml? I know that is possibile to do this programmatically and with standard layouts with weight but I need (if exist) the XML

Using ListView inside ConstraintLayout

眉间皱痕 提交于 2019-12-10 17:37:44
问题 I have read on Android Developers that ConstraintLayout can be used to design a responsive layout for an application. There is a parent ConstraintLayout which houses a toolbar and two other ConstraintLayouts. The first child ConstraintLayout is going to act as empty view for my ListView. The second ConstraintLayout holds my listview and a floating action button. Currently, the the listview appears under the Toolbar, rather than below it. Also as seen in the screenshot, the floating action

Android constraint layout strange behavior

爷,独闯天下 提交于 2019-12-10 15:53:47
问题 The version of my constraint layout is 1.0.0-alpha8 . After I have included a toolbar in my layout , there is space in both left and right side of the toolbar, like the image below Here is the code for my toolbar <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar 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="?attr/actionBarSize" android:background=

Layout editor: How to show layout in framelayout container?

巧了我就是萌 提交于 2019-12-10 13:55:09
问题 I have a layout defined in XML as root ConstraintLayout that contains 4 empty frameLayouts for dynamically inflating fragments. In order to have a better design experience in the layout editor (Android Studio), is there a way to show/mimic the intended layouts in each of these framelayouts? This question is not about loading a fragment in a container dynamically (in the code), I am looking for a solution that will allow me to load a layout in a container/Framelayout in the Layout Editor! 回答1:

Android ConstraintLayout @dimens replaced with hardcoded values

女生的网名这么多〃 提交于 2019-12-10 13:19:32
问题 Heyho mates, currently I am learning the new layout editor of Android Studio with the new ConstraintLayout . By the way, I hate it. But I got the issue, that if I want to specify a layout_height with @dimen , it gets replaced with a dp value instead. Someone else got this issue? Android Studio version 2.2.2 & 2.2.3 same issue. Newest gradle version. Thanks in advance guys! Edit : Code example : <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk

Constraint layout not showing image from ImageView when app run

自闭症网瘾萝莉.ら 提交于 2019-12-10 12:43:48
问题 I am trying to add some Images by ImageView in Android Activity(ConstraintLayout), on Android Studio Preview screen, it's showing images correctly, but when I am running the app on real device or emulator, it's not showing the image. Below is the code which I am using, <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas