android-xml

How to achieve Android UI like this image layout? About android:clipChildren

痴心易碎 提交于 2019-12-07 06:40:30
问题 What I want to achieve is like this layout: I have tried to use this code, to achieve like that image, but unfortunately, I failed. This is the snippet of my code: <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:clipChildren="false" > <RelativeLayout android:id="@+id/text_area_third" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/round_corner_background"

error:no resource identifier found for attribute“showAsAction” in package android

核能气质少年 提交于 2019-12-07 05:53:46
问题 I've been working on an Android project and encountered an error which I'm unable to solve for quite a while. Here is the error which says error:no resource identifier found for attribute"showAsAction" in package android and the error is in following file login_.xml <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/> 回答1: This attribute is introduced in API level 11. Check the min and target version of

How to programmatically check if a service is declared in AndroidManifest.xml?

回眸只為那壹抹淺笑 提交于 2019-12-07 03:25:13
问题 I'm writing a library that provides a Service that is used by other developers by including it in their project. As such, I don't have control over the AndroidManifest.xml. I explain what to do in the docs, but nevertheless a common problem is that people neglect to add the appropriate <service/> tag to their manifest, or add it in the wrong place. Right now, when my library calls startService while the service isn't declared in the manifest, the only thing that happens is that

How to have badge icon at corner of a layout

萝らか妹 提交于 2019-12-07 03:06:08
问题 I wanted to have a badge at corner of a layout . I managed to get badge inside the layout but not able to achieve at corner of it . Currently my code gives me : What i want : i want to have this badge to over right top corner of an layout . I want something like this : Toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas

Instantiating an inner class (Preference) in xml file

十年热恋 提交于 2019-12-06 21:19:12
问题 When you want to access a custom view in some layout.xml file, you have two options: The view is in it's own class. Then you do <package.name.MyView android:layout_width= ... /> The view is an inner class: <view class="package.name.OuterClass$MyView" android:layout_width= ... /> Now I want to do the same thing inside a <PreferenceScreen> . The first way works well, but I would like to put all the custom Preference classes together in my PreferenceActivity. I tried <Preference class="package

help : how can i do “include(in xml)” programmatically in my app Android?

纵饮孤独 提交于 2019-12-06 16:10:29
问题 i have in my layout.xml this lines : <include android:id="@+id/promo1" android:layout_width="fill_parent" android:layout_height="fill_parent" layout="@layout/one_promo"> </include> <include android:id="@+id/promo2" android:layout_width="fill_parent" android:layout_height="fill_parent" layout="@layout/one_promo"> </include> <include android:id="@+id/promo3" android:layout_width="fill_parent" android:layout_height="fill_parent" layout="@layout/one_promo"> </include> I want to do this

How to create a custom shape for a Button

谁都会走 提交于 2019-12-06 15:27:36
How to create a custom shape for a Button? Can I set different colors to button background colors for many conditions.Any help will be appreciated.Thanks. How to create a custom shape for a Button? Create a test.xml file in drawable and add code: <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/one"> //<---- id is must for color change <shape android:shape="rectangle"> <size android:width="150dp" android:height="40dp" /> <solid android:color="@color/colorPrimary" /> <corners android:radius="10dp"/> //<----

Behavior like tools:text in a custom view?

半世苍凉 提交于 2019-12-06 15:12:00
I have a custom view with two text views in the layout. Let's call one key and the other value . So you know how TextView has this? <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" tools:text="Preview text shown in the layout editor" /> I want to do something similar with my custom view, e.g.: <com.package.whatever.MyCustomView android:layout_width="wrap_content" android:layout_height="wrap_content" app:key_preview="Preview text for the key" app:value_preview="Preview text for the value" /> The constructor for MyCustomView is like so: public MyCustomView

how do i use both scroll view and RecyclerView in one xml layout android?

戏子无情 提交于 2019-12-06 12:54:46
In my application i am using recycler view and scrollview in one layout. it is not working when i am using both these views. If i remove scroll view only the recycler view is working. Plese any one help me hoe to fix this issue. my code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/r1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" > <ScrollView android:id="@+id/sc" android:layout_width="match_parent" android:layout_height="match

How to customize style from spinner dropdown CHOICES?

本秂侑毒 提交于 2019-12-06 12:26:45
I can customize the background of the selected option on a spinner dropdown using: <item name="android:spinnerStyle">@style/customSpinner</item> <style name="customSpinner" parent="@android:style/Widget.Holo.Light.Spinner"> <item name="android:textColor">#000000</item> <item name="android:background">#000000</item> </style> But I can't manage to change the background and textcolor of the list of options that the dropdown has. How do I achieve that? jiduvah adapter.setDropDownViewResource(R.layout.custom_spinner); custom_spinner.xml - <?xml version="1.0" encoding="utf-8"?> <TextView xmlns