android-xml

Android - rotate cuts off corners of shape

大城市里の小女人 提交于 2019-12-04 02:59:23
问题 I wish to make a diamond as a resource file so I am rotating a square in order to do so. The problem is that the corners seem to be getting cut off, making a hexagon instead. Also as a side note, I'd like to stretch it vertically if that's possible. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <rotate android:fromDegrees="45" android:pivotX="50%" android:pivotY="50%" android:toDegrees="45" > <shape android:shape="rectangle

How to align XML code in Android Studio?

时光怂恿深爱的人放手 提交于 2019-12-04 01:43:02
问题 is there any feature in Android Studio to align all XML attributes by '=' sign. I am unable to find any setting that would allow this. Just another code format fanatic who likes code readability. 回答1: below code will align everything but not after = sign. for better answer here Win/Linux: Ctrl + Alt + L Mac: Option + Command + L 回答2: Try like this Settings - Editor - XML 来源: https://stackoverflow.com/questions/28245890/how-to-align-xml-code-in-android-studio

Difference between android:id, android:name and name tags in Android XML files

我是研究僧i 提交于 2019-12-04 00:48:33
Can someone clarify the difference between android:id , android:name and name tags in Android's XML files. They all seem to be ways to reference things. For example, when I have a string array in the res/values/array.xml file I access using the name field in the defined array yet the Javadoc refers to this as the "ID". android:id seems to be just used in View s ? Am I missing something or would it not be simpler to have one tag? No, I don't believe you're missing anything. Although these fields are named differently, it's my understanding that they are both used to identify/reference resources

Get attribute name from string array

喜夏-厌秋 提交于 2019-12-04 00:29:07
问题 I have string array that looks like this: <string-array name="USA"> <item name="NY">001</item> <item name="LA">002</item> <item name="WA">003</item> </string-array> I can get those numbers by: Resources res = getResources(); int arryid = res.getIdentifier("USA", "array", getPackageName()); String[] numbers = res.getStringArray(arryid); But how can I also get the names (NY,LA,WA)? Note that I have a lot of counties... Maybe use different approach? 回答1: In the documentation there is no name

XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0

让人想犯罪 __ 提交于 2019-12-03 23:55:03
This is a follow up question to this question: Update Android Support Library to 23.2.0 cause error: XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0 I also updated the support library to 23.2 and started getting the error: XmlPullParserException Binary XML file line #17<vector> tag requires viewportWidth > 0 That question solved it for Android Studio and Gradle. How can this be solved when using Eclipse without Gradle? You can either switch back to the previous version of the appcompat library (Quick fix): compile 'com.android.support:appcompat-v7:23.1.1'

TextView getting cut in some resolutions

牧云@^-^@ 提交于 2019-12-03 23:37:50
问题 I have a RecyclerView which consists of CardView s that have a TextView and an ImageView , among some other layouts. The problem is, in some screen resolutions the TextView gets cut off or shoved to the next line, which I don't want. In other resolutions, the TextView has plenty of room. Small Resolutions: High Resolutions: How do I organize the layout so that there is enough room for the TextView , and the ImageView will be sized accordingly? This is my xml for the RecyclerView items:

Rendering issue in XML preview : Unable to locate mode 0 [duplicate]

☆樱花仙子☆ 提交于 2019-12-03 22:03:29
This question already has answers here : Closed 2 years ago . Exception raised during rendering: Unable to locate mode 0 (6 answers) After updating the android studio exception occured during rendering. Exception raised during rendering: Unable to locate mode 0 java.lang.IllegalStateException: Unable to locate mode 0 at android.view.DisplayInfo.findMode(DisplayInfo.java:458) at android.view.DisplayInfo.getMode(DisplayInfo.java:445) at android.view.Display.getRefreshRate(Display.java:648) at android.support.v7.widget.RecyclerView.onAttachedToWindow(RecyclerView.java:2392) at android.view.View

How do I use obtainStyledAttributes(int []) with internal Themes of Android

橙三吉。 提交于 2019-12-03 18:35:50
问题 So I have looked around and found out that android.R.styleable is no longer part of the SDK even though it is still documented here. That wouldn't really be an issue if it was clearly documented what the alternative is. For example the AOSP Calendar App is still using the android.R.styleable // Get the dim amount from the theme TypedArray a = obtainStyledAttributes(com.android.internal.R.styleable.Theme); lp.dimAmount = a.getFloat(android.R.styleable.Theme_backgroundDimAmount, 0.5f); a

ExpandableListView inside a scrollview

谁说胖子不能爱 提交于 2019-12-03 17:07:44
In my app i want to make a page that have ExpandableListView and below him CheckBox. My problem is that my ExpandableListView is too big and make the CheckBox out of the page. On smaller screens is not visible at all. I tried to put ExpandableListView inside scrollview but its not working. Is there a way to make my design? Here is my code and a screenshot. XML code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/White" >

Animate Two Layer Drawable Items Pre-Honeycomb

痞子三分冷 提交于 2019-12-03 16:17:05
问题 I am trying to animate two layers of a drawable to achieve the effect of the post-Honeycomb indeterminate progress indicator. The XML is very straightforward but it would seem that only one layer will animate when run on platforms prior to Honeycomb. <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <rotate android:drawable="@drawable/abs__spinner_48_outer_holo" android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0" android:toDegrees="1080" /> </item>