android-xml

How can I access a BuildConfig value in my AndroidManifest.xml file?

☆樱花仙子☆ 提交于 2019-11-28 02:56:12
Is it possible to access a BuildConfig value from AndroidManifest.xml? In my build.gradle file, I have: defaultConfig { applicationId "com.compagny.product" minSdkVersion 16 targetSdkVersion 21 versionCode 1 versionName "1.0" // Facebook app id buildConfigField "long", "FACEBOOK_APP_ID", FACEBOOK_APP_ID } FACEBOOK_APP_ID is defined in my gradle.properties files: # Facebook identifier (app ID) FACEBOOK_APP_ID=XXXXXXXXXX To use Facebook connect in my app, I must add this line to my AndroidManifest.xml: <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/applicationId"

Every time I click on an Android XML file in Eclipse, it loads data for all API versions

ぃ、小莉子 提交于 2019-11-28 00:41:48
As described in the title, every time an XML file (layout or manifest) is clicked, progress shows "Loading data for ..." - and it does it for every version of the API, 2.1 to 4.4.2. Is there any way of stopping this behaviour. as it slows the system down a great deal ? Update: I've raised an AOSP bug report for this. Update 2: I'm pleased to say that the AOSP team have now raised the priority for a fix to 'Critical'. Update 3: 8 days later and I'm not pleased to say that despite it being marked as a critical bug, it's still waiting on release 22.6.2 to provide a complete fix. Update 4: Finally

Android: include a xml into an other xml

本秂侑毒 提交于 2019-11-28 00:39:35
How to include a xml data into an other xml data i have a header xml-file for my application wich i want to use in my special other content xmls is there a ways to include the header into my content? use include tag <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <!-- Header --> <include android:id="@+id/container_header_lyt" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_above=... android:layout_toLeftOf=... layout="

Set layout_column and layout_row in GridLayout programmatically

*爱你&永不变心* 提交于 2019-11-27 23:37:49
I have a GridLayout (not GridView) where I want to add some views with a special row and column inex. In XML I can set the View with: <TextView android:id="@+id/textView1" android:layout_column="2" android:layout_row="4" android:text="Large Text" /> But how can I set the attributes layout_column and layout_row programmatically? I want something like this: GridLayout grid = new GridLayout(getActivity()); grid.setColumn(2); grid.setRow(4); grid.addView(new Button(getActivity()); The equivalent of layout_column and layout_row , as with all layout_... parameters, is to be found as a parameter of a

How can I recreate this background in xml?

寵の児 提交于 2019-11-27 23:10:52
I've been trying to recreate a background image in xml (as drawable). Since the background is a simple shape, it would be better if it is created as xml drawable. The is a really large gradient circle that squares off at the left, top and right border. What I've tried <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <size android:height="20dp" /> <gradient android:type="linear" android:startColor="@color/gradientLeft" android:centerColor="@color/gradientMiddle" android:endColor="@color

Dynamic vs XML layout in Android?

与世无争的帅哥 提交于 2019-11-27 22:52:57
I'm new to Android development and have started creating my own UI. I see that you can either create it dynamically something like this ( Dynamic Layouts ): @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); TextView tv = new TextView(this); tv.setText("Name"); ll.addView(tv); EditText et = new EditText(this); ll.addView(et); Button b = new Button(this); b.setText("Ok"); ll.addView(b); } but I also see that

Plural definition is ignored for zero quantity

梦想与她 提交于 2019-11-27 22:42:01
I use plurals to compile a quantity string for an Android application. I follow exactly what one can find in the tutorials: res.getQuantityString( R.plurals.number_of_comments, commentsCount, commentsCount); Here is the definition of the plurals: <?xml version="1.0" encoding="utf-8"?> <resources> <plurals name="number_of_comments"> <item quantity="zero">No comments</item> <item quantity="one">One comment</item> <item quantity="other">%d comments</item> </plurals> </resources> Interesting enough, the output string is odd to what I definied: commentsCount = 0 => "0 comments" commentsCount = 1 =>

How to combine BottomAppBar + FAB with BottomNavigationView

不羁的心 提交于 2019-11-27 22:28:08
I want to use the FloatingActionButton , along with its behaviour when anchored on a BottomAppBar, on top of a BottomNavigationView. I came up with a rather "hacky" trick to just place the BottomNavigationView on top of the BottomAppBar without providing a background thus making it transparent. This seemed to work well at first sight but I found out that the fab button can only be clicked when touching the upper half of the button (So where there is no transparent BottomNavigationView on top). <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res

Android scrollview hiding top content in layout

a 夏天 提交于 2019-11-27 21:49:07
Im having a problem where the android scrollview starts hiding a pair of textviews I have at the top of my layout, I have found another person on this very site who had that problem and was able to get help unfortunately the person who helped them didnt actually say what fixes it, can anyone tell me what was the fix here? android scrollview hiding top content any help would be huge here is my xml code: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width=

Android: Best XML Parsing Library?

喜夏-厌秋 提交于 2019-11-27 21:15:15
I have to parse some complex xml files inside my Android application. Is there any good library for doing that like there is TouchXMl for iPhone? Or you could use the org.xmlpull.v1.XmlPullParser - I've found it much easier to use than the SAX Parser and it has other benefits: http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html http://www.bearcave.com/software/java/xml/xmlpull.html The SAX XML Parser comes already built into the Android SDK. Use Woodstox . It's a Stax pull parser, actually supports all of XML (unlike xmlpull that is bundled), efficient, mature. For more