android-xml

How rotate line in Android XML?

房东的猫 提交于 2019-11-28 23:20:17
I'm trying to draw a diagonal line in an Android app with the XML, but it is not working. It simply draws a horizontal line. main.xml : <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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".TestActivity" > <RelativeLayout

Android CalendarView slowing down layout

点点圈 提交于 2019-11-28 23:18:35
This is driving me crazy. I have a fragment in my Android app which is laid out using a RelativeLayout. Problem is that for some reason it takes ages to render, about 5 seconds just to load about 4 elements on screen. One of the elements is a CalendarView and when I remove it it goes back to proper speeds (ie: instant). I'd imagine the problem is got to do with the way I'm asking Android to lay it out, must not make much sense or is inefficient or something. Here's the XML file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

Android- How to implement Horizontal Step Progress Bar

回眸只為那壹抹淺笑 提交于 2019-11-28 22:46:21
问题 I want to implement horizontal progress bar with steps like shown in following img. I could not find such native component in Android. Can anyone guide me on how to do it ? 回答1: EDIT: A repo which seems to currently be well supported and used (Sep 2016) https://github.com/baoyachi/StepView Old Answer: This answer is late to the party, but so far the best I've found is this repo from Anton46: https://github.com/anton46/Android-StepsView It's quite simple to setup too. Heres an example: 回答2: I

How to add a horizontal 1px line above image view in a relative layout?

喜夏-厌秋 提交于 2019-11-28 21:06:48
How do I add a horizontal 1px white line above image view in a relative layout? <RelativeLayout android:id="@+id/widget38" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_x="108px" android:layout_y="87px" > <ImageView android:id="@+id/widget39" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" > </ImageView> </RelativeLayout> blindstuff Just add the following line in your XML where ever you want it. <View android:background="#ffffff" android:layout_width =

How can I create a weekly calendar view for an Android Honeycomb application?

南楼画角 提交于 2019-11-28 20:35:28
问题 I am working on an Android (v3.0) application that has a requirement of mimicking the weekly calendar layout found on Google Calendar: The events will be based on external requests through the Google Calendar API (I already have this part working). Using the API, I can obtain a list of events for the week, with each event having a starting and and ending datetime. I would like to use this data to show the scheduled events to the application's users in a view similar to the one above. Here's

How to concatenate multiple strings in android XML? [duplicate]

余生颓废 提交于 2019-11-28 19:28:42
问题 This question already has answers here : Reference one string from another string in strings.xml? (11 answers) Closed 4 years ago . Problem I would like to be able to do something like that in Android XML code: <string name="title">@string/app_name test</string> <string name="title2">@string/app_name @string/version_name</string> Regarding first line of code compiler shows this error No resource found that matches the given name (at 'title' with value '@string/app_name test') and regarding

How can I draw circle through XML Drawable - Android? [duplicate]

狂风中的少年 提交于 2019-11-28 18:05:35
This question already has an answer here: How to get round shape in Android [duplicate] 1 answer I'm trying to draw circle with the help of XML file in android, but circle is not displaying properly. Below code is showing Oval. How can I create circle in XML file. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF" android:angle="45"/> <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" /> <corners android:radius="10dip" /> </shape> Any help would be

Is it possible to rotate a drawable in the xml description?

坚强是说给别人听的谎言 提交于 2019-11-28 17:20:57
I am creating an app, with resources that can be reused (because buttons are always the same, but mirrored or rotated). I do want to use the same resource so I don't have to add 3 more resources that are exactly like the original but rotated. But I also don't want to mix the code with things that can be declared in the XML or make transformations with a matrix that will cost processing time. I've got a two state button declared in an XML. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android

Toolbar in AppBarLayout is scrollable although RecyclerView has not enough content to scroll

只愿长相守 提交于 2019-11-28 16:03:36
Is it really intended that the Toolbar in a AppBarLayout is scrollable although the main container with the "appbar_scrolling_view_behavior" has not enough content to really scroll? What I have tested so far: When I use a NestedScrollView (with "wrap_content" attribute) as main container and a TextView as child, the AppBarLayout works properly and does not scroll. However, when I use a RecyclerView with only a few entries and the "wrap_content" attribute (so that there is no need to scroll), the Toolbar in the AppBarLayout is scrollable even though the RecyclerView never receives a scroll

How to draw a dot circle inside a square drawable in android?

天涯浪子 提交于 2019-11-28 12:18:17
问题 I want a small dot inside a square button , this is what i have tried till now as answered by azizbekian: <?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:width="100dp" android:height="100dp"/> <solid android:color="#38b0ef"/> </shape> </item> <item android:bottom="45dp" android:left="45dp" android:right="45dp" android:top="45dp"> <shape android:shape="oval"> <stroke android