android-xml

How to create curved bottom border rectangle in android?

血红的双手。 提交于 2019-12-19 08:09:35
问题 how to create android drawable with perfect curved bottom using xml like this : i have tried this xml, but the result didn't perfect <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#5f9c63"/> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> <corners android:bottomRightRadius="100dp" android:bottomLeftRadius="100dp" android:topLeftRadius="0dp" android:topRightRadius="0dp"/>

The following classes could not be instantiated: - com.google.android.gms.plus.PlusOneButton

会有一股神秘感。 提交于 2019-12-18 22:38:08
问题 I am following this tutorial https://developers.google.com/+/mobile/android/recommend to integrate +1 button in my app. As soon as I put this code in xml I get errors in GraphicalLayout <com.google.android.gms.plus.PlusOneButton xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" android:id="@+id/plus_one_button" android:layout_width="wrap_content" android:layout_height="wrap_content" plus:size="standard" plus:annotation="inline" /> I also tried putting xmlns:plus=

How to change `solid color` from the code?

半腔热情 提交于 2019-12-18 18:47:47
问题 I have a Shape defined in xml . Now I need to change a solid color from the code, could you please advice how? <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#000000"/> <corners android:bottomRightRadius="8dp" android:bottomLeftRadius="8dp" android:topLeftRadius="0dp" android:topRightRadius="0dp"/> </shape> 回答1: I use this in my code GradientDrawable myGrad =

Unable to use LayoutInflater in custom adapter

こ雲淡風輕ζ 提交于 2019-12-18 15:56:39
问题 I'm looking into writing a custom adapter to populate a listview with 3 textviews per line. I've found quite a bit of example code to do this, but the one that seemed the best was at: http://www.anddev.org/custom_widget_adapters-t1796.html After a few minor tweaks to fix some compiler issues with the latest Android SDK, I got it running, only to get the exception: ERROR/AndroidRuntime(281): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView So

Unable to use LayoutInflater in custom adapter

扶醉桌前 提交于 2019-12-18 15:54:58
问题 I'm looking into writing a custom adapter to populate a listview with 3 textviews per line. I've found quite a bit of example code to do this, but the one that seemed the best was at: http://www.anddev.org/custom_widget_adapters-t1796.html After a few minor tweaks to fix some compiler issues with the latest Android SDK, I got it running, only to get the exception: ERROR/AndroidRuntime(281): java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView So

Change the Color of ScrollView Programmatically

时间秒杀一切 提交于 2019-12-18 13:21:14
问题 What I'm currently doing Currently, I have changed the scrollbar in my XML file using the android:scrollbarThumbVertical property like so: <ScrollView android:id="@+id/scrollView1" android:scrollbarThumbVertical="@drawable/scrollbar_blue" ... > And scrollbar_blue refers to my scrollbar_blue.xml file, which is this: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <gradient android:angle="45" android:centerColor="@color/blue" android

Android textview not supporting line break

送分小仙女□ 提交于 2019-12-18 12:52:54
问题 I'm creating a custom view programmatically that is displaying text that is parsed from an XML file. The text is long and contains the "/n" character for force line breaks. For some reason, the text view is displaying the /n and there isn't any line breaks. Here is my code: // get the first section body Object body1 = tempDict.get("FIRE"); String fireText = body1.toString(); // create the section body TextView fireBody = new TextView(getActivity()); fireBody.setTextColor(getResources()

Are there any side-effects of using multiple string.xml files?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 12:45:36
问题 I am currently creating an application that have some strings (>300 for now) and I have some problems to quickly find a string with so many of them. So I was considering the possibility of using several string.xml files instead of only one (string_menu, string_activity1, ...). Is there any side-effect with this practice? Is it a bad or a good practice? I ask this because it seems that no many people on the net are using this possibility. So maybe there is some problem with it? 回答1: As stated

How to change the height of the 'Log in with Facebook' button?

为君一笑 提交于 2019-12-18 12:43:23
问题 I already tried several answers I could find but none of them worked with the latest Facebook Android SDK version 4.0. How can I change the layout height with the latest SDK? 回答1: Just set paddingTop and paddingBottom. It works for me. <com.facebook.login.widget.LoginButton android:id="@+id/login_facebook_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingTop="15dp" android:paddingBottom="15dp" android:layout_marginRight="30dp" android:layout

Android - ImageView overlay another ImageView

房东的猫 提交于 2019-12-18 11:31:44
问题 I would like to make an ImageView overlay another ImageView like this; only half of the circle green is overlaying the image: I have tried using RelativeLayout and put both ImageView inside. Then I overlay the circle over the image by using android:layout_alignBottom . It did overlay the but I have no idea how to set the offset so that only half of the circle is overlaying the base image. EDIT: Sorry, here is my layout xml code <RelativeLayout android:layout_width="wrap_content" android