Horizontal progressbar with custom color

Categories: ANDROID like

activity_main.xml <progressbar android:id=”@+id/progressBar” style=”?android:progressBarStyleHorizontal” android:layout_width=”match_parent” android:layout_height=”1dp” android:layout_margin=”0dp” android:max=”100″ android:padding=”0dp” tools:progress=”40″ android:progressDrawable=”@drawable/progress_drawable” app:layout_collapseMode=”pin”/> MainActivity.java ProgressBar mProgressBar = (ProgressBar) findViewById(R.id.progressBar); //somewhere when scrollin mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); int lastVisiblePosition = mLayoutManager.findLastVisibleItemPosition(); int allItem = mLayoutManager.getItemCount(); if (allItem > 0) { double v = ((double) lastVisiblePosition […]

Converting transparency color to hex

Categories: ANDROID like

Here is very interesting post I have found on stackoverflow. I though it is worth to repost here. Android uses Hex ARGB values, which are formatted as #AARRGGBB. That first pair of letters, the AA, represent the Alpha Channel. You must convert your decimal opacity values to a Hexdecimal value. Here are the steps: Alpha […]

Better style for stackoverflow front page – grasemonkey script

Categories: NON ANDROID like

Here is script for better front page style. [javascript] // ==UserScript== // @name Better style for stackoverflow front page // @namespace // @description changes background of front page and interesting items // @include *stackoverflow.com* // @version 1 // @grant GM_addStyle // ==/UserScript== document.body.style.background = “#f0f0f0”; GM_addStyle(‘.tagged-interesting {background-color:#f5f5f5; padding:5px}’); [/javascript]

Working example – changing drawable background in runtime, dynamically

Categories: NON ANDROID like

Here is a short example code how to do it: I’ve created xml file shape.xml and one method for flexible changing color of shape. shape.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <solid android:color="@android:color/holo_blue_bright" /> <corners android:radius="30dp" /> <size android:height="15dp" android:width="15dp" /> </shape> And here is a method for flexible changing color: