android-layout

ConstraintLayout max width percentage

▼魔方 西西 提交于 2021-02-17 08:46:24
问题 I've been experimenting with ConstraintLayout, is there a way to set the max width of a view to a percentage of the parent (and a height of match constraint and dimension ratio of 1:1)? Here is the code without using max width: <?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" android:layout_width="match_parent" android:layout_height="wrap_content">

ConstraintLayout max width percentage

只愿长相守 提交于 2021-02-17 08:46:12
问题 I've been experimenting with ConstraintLayout, is there a way to set the max width of a view to a percentage of the parent (and a height of match constraint and dimension ratio of 1:1)? Here is the code without using max width: <?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" android:layout_width="match_parent" android:layout_height="wrap_content">

Android toolbar elevation when scrolling

泪湿孤枕 提交于 2021-02-17 08:44:56
问题 I try to implement a search bar like in google maps android app: When the recycler view is in its initial state, the toolbar has no elevation. Only when the users starts scrolling the elevation becomes visible. And the search bar (toolbar) never collapses. Here is what I tried to replicate this: <android.support.design.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <android.support.v7.widget.RecyclerView

Android make oval background drawable with chat corner

蹲街弑〆低调 提交于 2021-02-16 16:25:07
问题 I know how to create oval background, I add this drawable to a RelativeLayout background: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape> But I want to create this drawable and the corner of a chat like this: How can I add to this drawable the corner

Android make oval background drawable with chat corner

断了今生、忘了曾经 提交于 2021-02-16 16:24:34
问题 I know how to create oval background, I add this drawable to a RelativeLayout background: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape> But I want to create this drawable and the corner of a chat like this: How can I add to this drawable the corner

How to adjust space between radio button in android

核能气质少年 提交于 2021-02-16 14:55:47
问题 In my android application using radio buttons to select screen view. I want radio button equally aligned horizontal. I tried layout xml shown below. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Views" android:paddingLeft="10dp"

Unresolved reference - activity does not recognize synthetic imports in android studio v4

五迷三道 提交于 2021-02-13 05:40:42
问题 last night I noticed I'm not able to change the attributes of elements in the layout from my main activity so I built a new project and I had the same problem there too. I could not find out what was wrong with my android studio so I'd appreciate it if someone with the same problem helps me out. as you see in the picture when I call a defined view from the layout in my activity its not recognized the error will be: Unresolved reference: txtHello 回答1: Kotlin Synthetic imports not working ?

How to Design Hexagon In Xamarin Form Android Visual Studio 2019

不羁的心 提交于 2021-02-11 18:21:00
问题 i need to develop android application with xamarin android using visual studio 2019, my goal is create design hexagon in form xml. for detail ilustration like below : i have image like below: and then i wanna place that picture in the grid, with expectation like below : i try code like this : <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms

How to align the output text in order

北城以北 提交于 2021-02-11 18:02:04
问题 I am facing a problem aligning the text in proper format EX: say I am to get printout in the following way Name Phone No. Adithya 99999999999 Ravi 99999999999 Teja 99999999999 : : but as the length of the String Adithya is not equal to length of Ravi we cannot give specific spacing such as String s = Name+ " " + Phone + "\n"; here if I give so I'll get in the following way Name Ph Adithya 9999999 Ravi 9999999 Tej 9999999 : : it will display in this way. How can I solve this? 回答1: This problem

Generated binding class that only takes a LayoutInflater as its sole argument

随声附和 提交于 2021-02-11 16:45:42
问题 The generated binding class from the Android Data Binding library has different versions of the inflate method: One that looks like the usual LayoutInflater.inflate method that takes a viewGroup and attachToRoot parameter, and one that only takes a LayoutInflater and nothing else. The documentation doesn't explain the difference between the two and unfortunately Android Studio doesn't let me step through the source code of inflate so that I could figure out which values it is using internally