android-xml

Android: Best XML Parsing Library?

只谈情不闲聊 提交于 2019-11-26 23:01:46
问题 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? 回答1: 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 回答2: The SAX XML Parser comes already built into the Android SDK. 回答3: Use Woodstox.

No shadow/elevation underneath second card if there are two card in the layout. Why?

百般思念 提交于 2019-11-26 22:19:02
问题 I have 2 cards in a single RelativeLayout . The problem is that there is no elevation or shadow underneath the second card. See the screenshot here: screenshot Here's what I have done in the xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/colorPrimary" xmlns:app="http:/

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

随声附和 提交于 2019-11-26 21:48:26
问题 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

Android: include a xml into an other xml

主宰稳场 提交于 2019-11-26 21:45:54
问题 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? 回答1: 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=

How can I recreate this background in xml?

ε祈祈猫儿з 提交于 2019-11-26 21:22:05
问题 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

Dynamic vs XML layout in Android?

社会主义新天地 提交于 2019-11-26 21:13:28
问题 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

How to add id to public.xml?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 20:22:06
问题 In my project, I needed to set always-constant IDs to Views. I mean IDs that are constant between different app builds. After some investigation I found that it can be achieved by using values/public.xml and any id declared in that file would not change on future builds. Now the problem is that I can't define an id of a view in some layout file. This is my layout.xml containing an ImageView with an Id which should be added to public.xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout

Android Cannot resolve symbol '?attr/selectableItemBackground'

让人想犯罪 __ 提交于 2019-11-26 20:05:56
问题 <android.support.v7.widget.CardView android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="@dimen/card_outer_padding" android:layout_marginTop="@dimen/card_outer_padding" android:layout_marginRight="@dimen/card_outer_padding" android:layout_marginBottom='@{model.cardBottomMargin}' android:foreground="?attr/selectableItemBackground" android:onClick="@{model::onCardClick}" app:cardElevation="2dp" app:cardCornerRadius="2dp"

Custom attributes in styles.xml

∥☆過路亽.° 提交于 2019-11-26 19:40:44
I have created a custom widget, and I'm declaring it in layout.xml. I have also added some custom attributes in attr.xml. However, when trying to declare these attributes in a style in styles.xml, it's giving me No resource found that matches the given name: attr 'custom:attribute'. I have put the xmlns:custom="http://schemas.android.com/apk/res/com.my.package" in all of the tags in styles.xml, including <?xml> , <resources> , and <style> , but it still gives me the same error, that it can't find my custom XML namespace. I can, however, use my namespace to manually assign attributes to the

Android getMeasuredHeight returns wrong values !

烈酒焚心 提交于 2019-11-26 18:10:31
问题 I'm trying to determine the real dimension in pixels of some UI elements ! Those elements are inflated from a .xml file and are initialized with dip width and height so that the GUI will eventually support multiple screen size and dpi (as recommended by android specs). <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="150dip" android:orientation="vertical"> <ImageView android:id="@+id/TlFrame" android:layout