android-layout

Android EditText error message popup text not showing

末鹿安然 提交于 2021-01-27 05:16:22
问题 I'm having an issue in my app where the error popup on EditTexts shows but the text is not visible. It looks something like this: This happens with all the EditText s in my app. Here's an example layout XML Layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout 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/main_content"

Listen on a View if the View change its XY position

痴心易碎 提交于 2021-01-27 04:45:16
问题 How do I listen on a View to obtain its XY coordination if it is moving or its XY position change? The View is not necessary to be dragged (or by user touch event), it may change if the orientation change or pushed (upward) by the showing keyboard or etc. I want to know its updated XY coordination when it changes, how can I do that? 回答1: You may do something like this final View activityRootView = findViewById(R.id.mainLayout); activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(

Android custom circular ProgressBar direction

青春壹個敷衍的年華 提交于 2021-01-27 04:01:52
问题 I have a custom Circular Progressbar. This is the drawable I have for it to be determinate: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/secondaryProgress"> <shape android:innerRadiusRatio="6" android:shape="ring" android:thicknessRatio="20.0" android:useLevel="true"> <gradient android:centerColor="#999999" android:endColor="#999999" android:startColor="#999999" android:type="sweep" /> </shape> <

Padding doesn't work on some devices

无人久伴 提交于 2021-01-27 03:54:31
问题 I had a strange problems during the set padding to EditText . xml looks like this: <EditText android:layout_width="270dp" android:layout_height="55dp" android:ems="10" android:id="@+id/etEmail" android:textStyle="bold" android:layout_gravity="center_vertical" android:textColor="#FFFFFF" android:hint="Or Use your Email" android:inputType="textEmailAddress" android:layout_alignLeft="@+id/textView6" android:layout_alignStart="@+id/textView6" android:textColorHint="#FFFFFF" android:background="

Padding doesn't work on some devices

耗尽温柔 提交于 2021-01-27 03:54:29
问题 I had a strange problems during the set padding to EditText . xml looks like this: <EditText android:layout_width="270dp" android:layout_height="55dp" android:ems="10" android:id="@+id/etEmail" android:textStyle="bold" android:layout_gravity="center_vertical" android:textColor="#FFFFFF" android:hint="Or Use your Email" android:inputType="textEmailAddress" android:layout_alignLeft="@+id/textView6" android:layout_alignStart="@+id/textView6" android:textColorHint="#FFFFFF" android:background="

How can I pass multiple arguments via xml for a custom setter when using Android data binding

本秂侑毒 提交于 2021-01-27 02:58:20
问题 Suppose I have a custom setter method where I need two arguments: @BindingAdapter({"imageUrl", "placeholder"}) public static void loadImage(ImageView imageView, String imageUrl, Drawable drawable) { Picasso.with(imageView.getContext()).load(imageUrl).placeholder(drawable).into(imageView); } What would the corresponding xml look like? 回答1: Looks like it can be done like this: <ImageView app:imageUrl=“@{data.imageUrl}” app:placeholder=“@{@drawable/placeholder}”/> see http://developer.android

How can I pass multiple arguments via xml for a custom setter when using Android data binding

戏子无情 提交于 2021-01-27 02:56:45
问题 Suppose I have a custom setter method where I need two arguments: @BindingAdapter({"imageUrl", "placeholder"}) public static void loadImage(ImageView imageView, String imageUrl, Drawable drawable) { Picasso.with(imageView.getContext()).load(imageUrl).placeholder(drawable).into(imageView); } What would the corresponding xml look like? 回答1: Looks like it can be done like this: <ImageView app:imageUrl=“@{data.imageUrl}” app:placeholder=“@{@drawable/placeholder}”/> see http://developer.android

Can I always use lint ignore NewApi instead of different styles.xml files?

天涯浪子 提交于 2021-01-27 02:43:20
问题 I have two styles.xml, one in values another in values-v21 resource folders. values/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> </resources> values-v21/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name=

Can I always use lint ignore NewApi instead of different styles.xml files?

空扰寡人 提交于 2021-01-27 02:43:09
问题 I have two styles.xml, one in values another in values-v21 resource folders. values/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> </resources> values-v21/styles.xml content is: <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name=

change position of spinner dropdown list

点点圈 提交于 2021-01-26 23:50:43
问题 I need to change the horisontal position of Spinner's dropdown list. here's the screenshot : and I want this dropdown list to go in one line under the main icon/text so it would look fine As on the picture : here's what I do in xml : <Spinner android:id="@+id/tvHeader" style="@style/spinner_style" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/ver_main_donate_background_tile_long" android:layout_alignTop="@+id/ver_main_donate