android-drawable

Change <layer-item> items by Java code

此生再无相见时 提交于 2019-12-19 07:27:25
问题 I have the following XML: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/customPlayerProgressBg"> <shape> <gradient android:startColor="#FF999999" android:endColor="#FF999999" /> </shape> </item> <item android:id="@+id/customPlayerProgressSecondary"> <clip> <shape> <gradient android:startColor="#FF5C3C68" android:endColor="#FF5C3C68" /> </shape> </clip> </item> <item android:id="@+id/customPlayerProgress" > <clip> <shape> <gradient android

drawable v21, v24? what is it? [duplicate]

余生长醉 提交于 2019-12-19 07:23:26
问题 This question already has an answer here : Newer versions of Android Studio and only two drawable directory - drawable and drawable-v21 (1 answer) Closed 2 years ago . When I'm creating drawables some of them goes to v21, v24 folder. Why is this happening? Will they appear in andoid api 15 (android 4)? Do I need to do something? 回答1: Those drawable folders are actually for providing device compatibility (i.e. to manage different screen densities in android) and different android versions. 来源:

How to open Side bar on icon click in Android?

时光总嘲笑我的痴心妄想 提交于 2019-12-19 04:46:58
问题 I have implemented Hamburger bar with App toolbar and both of them are working fine. Following is the snapshot of toolbar and hamburger bar: Hamburger bar I can open this bar by sliding it but I also want to make it open by clicking on drawable icon (right top corner icon). How can i do that? MainActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar);

What is new in Drawable Tinting in Android L Developer Preview compared to previous version?

与世无争的帅哥 提交于 2019-12-18 12:49:28
问题 I am working of new Android L preview and now dealing with tinting concept on drawable. I want to know if there is anything new regarding drawable tinting in Android L Developer Preview. I read this this documentation which says: The Android L Developer Preview enables you to define bitmaps or nine-patches as alpha masks and to tint them using a color resource or a theme attribute that resolves to a color resource (for example, ?android:attr/colorPrimary ). You can create these assets only

Using a gradientDrawable with more than three colors set

不羁的心 提交于 2019-12-18 12:16:29
问题 According to what I've read, you can use a gradientDrawable and have three colors set for it, for example: <gradient startColor="#00FF00" centerColor="#FFFF00" endColor="#FFFFFF"/> But what if I want more than three colors, and not only that, I want to be able to set where to put each (in weight/percentage)? Is it possible using the API or should I make my own customized drawable? If I need to make my own customized drawable, how should I do it? 回答1: put this code in your onCreate() method:

DrawableCompat setTint not working on API 19

给你一囗甜甜゛ 提交于 2019-12-18 11:48:52
问题 I am using the DrawableCompat for tinting drawable as below, tinting doesn't seem to be working on API 19. I am using the support lib version 23.3.0 Drawable drawable = textView.getCompoundDrawables()[drawablePosition]; if (drawable != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { drawable.setTint(color); } else { DrawableCompat.setTint(DrawableCompat.wrap(drawable), color); } } 回答1: I had the same problem. I combined the posts in https://stackoverflow.com/a/30928051

How to use RoundedBitmapDrawable

点点圈 提交于 2019-12-18 10:10:13
问题 Has anyone managed to use RoundedBitmapDrawable ? Correct me if I'm wrong, but to my understanding, it makes a circular image from a regular rectangular image. What I've tried so far is this RoundedBitmapDrawable.createRoundedBitmapDrawable(getResources(), BitmapFactory.decodeResource(getResources(), iconResource)) What I tried to achieve: transform any image to a circular image and show it using an ImageView. In case I mixed things up and all that I said is non-sense. Is it possible (or

Android Multilevel expandable list view set third level child item clicked

给你一囗甜甜゛ 提交于 2019-12-18 09:38:10
问题 i have codes from this project, and i want to implement expandable third level child OnItemClick, i tried to use concept from this 2 level expandablelistview child click listener but it did not work. SO how can i make user know has selected certain parent/group level, second level and third level items. here is my codes: MainPageActivity.java public class MainPageActivity extends AppCompatActivity { private ExpandableListView expandableListView; String[] parent = new String[]{"group 1",

How does ProgressBar drawable work?

独自空忆成欢 提交于 2019-12-17 20:38:06
问题 Background I wanted to make a rounded progress bar that is determinate (meaning android:indeterminate="false" ), so I searched the Internet and found a short answer of Romain Guy, here. So I grabbed the code and used it in a sample project: the (part of the) layout file: <ProgressBar android:layout_width="50dp" android:layout_height="50dp" android:background="@color/backColor" android:indeterminate="false" android:indeterminateOnly="false" android:max="100" android:progress="33" android

Building a 9 patch drawable at runtime

末鹿安然 提交于 2019-12-17 18:24:25
问题 I am successfully building a 9patch drawable at runtime on Android 3.0+ using the excellent gist provided by Brian Griffey (found here). Essentially I load the raw (no patches) graphic file from the network and the filename contains the cap insets that I need to use in order to scale the image accordingly. I then use these values with the class found above and apply the image as a background to a variety of elements (such as TextView , ImageButton , Button , ViewGroup , etc). This works