android-layout

Lollipop Progress Bar Tinting

喜你入骨 提交于 2021-02-06 07:18:22
问题 I'm on a Lollipop device (MotoG 2014), I read about progress bar tinting, but this is not working...I get the default progress bar color. What am I missing here? <ProgressBar style="?android:attr/progressBarStyleLarge" android:layout_width="50dp" android:layout_height="50dp" android:backgroundTintMode="src_in" android:indeterminate="true" android:indeterminateTint="#f00" /> Many thanks. 回答1: The accepted solution wasn't working for me on pre-Lollipop, but I found this solution to fit all APIs

Why use a CardView instead of a RelativeLayout or LinearLayout?

守給你的承諾、 提交于 2021-02-06 07:01:11
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

Why use a CardView instead of a RelativeLayout or LinearLayout?

人盡茶涼 提交于 2021-02-06 06:56:39
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

Why use a CardView instead of a RelativeLayout or LinearLayout?

邮差的信 提交于 2021-02-06 06:56:26
问题 I have a RecyclerView for displaying a list of items. There is this android CardView class given by android to show card layout. If I use a RelativeLayout and set its background to white it works the same way. Also in case of CardView I have to anyway add a childlayout to it which basically contains the all the views inside the card. So I wanted to know if their is any benefit of using a CardView (which actually increases the hierarchy of the views) rather than a normal Layout directly. 回答1:

How to fit Image into ImageView using Glide

∥☆過路亽.° 提交于 2021-02-05 13:10:04
问题 My concern is how to fit image using android:scaleType="fitXY" into image using Glide . My ImageView is <ImageView android:id="@+id/img_pager" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:scaleType="fitXY" /> Loads image using Glide like this Glide.with(context).load(url).placeholder(R.drawable.default_image).into(img); but image is not getting fit into ImageView it show space on image either side as shown in screen I

findViewById not working for specific view

蹲街弑〆低调 提交于 2021-02-05 06:38:21
问题 I have an activity loaded from XML, with views having IDs as usual: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="80dp" android:layout_height="110dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <FrameLayout android:layout_width="70dp" android:layout_height="70dp" android:layout_gravity="center_horizontal" android:background="

ConstraintLayout: center view on full screen but limit width to not overlap with side views

有些话、适合烂在心里 提交于 2021-02-04 21:40:15
问题 I have a toolbar like component implementation, that I'm having trouble with the layout in all situations. It has a left icon, a title and a right menu/button. I need the title to be centered on the full screen (or at least the full width of the layout) but also to not overlap with the other components. So the width of the title would have to be constrained by the left icon and the right button. I have two intermediary solutions but can't seem to find a way to combine them. One is to center

ConstraintLayout: center view on full screen but limit width to not overlap with side views

大憨熊 提交于 2021-02-04 21:38:59
问题 I have a toolbar like component implementation, that I'm having trouble with the layout in all situations. It has a left icon, a title and a right menu/button. I need the title to be centered on the full screen (or at least the full width of the layout) but also to not overlap with the other components. So the width of the title would have to be constrained by the left icon and the right button. I have two intermediary solutions but can't seem to find a way to combine them. One is to center

RecyclerView inside a RecyclerView

雨燕双飞 提交于 2021-02-04 21:34:21
问题 I have this RecyclerView , which in it every item has a RecyclerView inside of it: fragment_active_goals.xml (contains the outer recyclerview): <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/parent" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragments.ActiveGoalsFragment

Efficiently Inflating a lot of Views within several Horizontal LinearLayout with Adapters

荒凉一梦 提交于 2021-02-04 20:15:02
问题 I have a question about how to improve the performance of a large horizontal linear layout. I am creating a table like view that can have anywhere from 50 to 2,500 entries. Each entry is a LinearLayout containing a TextView with some simple text. I have implemented the design by utilizing the LinearListView library. This library allows an ListAdapter to be bound to a LinearLayout to display a view in a horizontal or vertical orientation. The way I have implemented this currently is by