Changing size of seekbar thumb

The most flexible way to set thumb size for me is to create layered-drawable with shape as placeholder thumb_image.xml: <layer-list xmlns:android=”http://schemas.android.com/apk/res/android” > <item> <shape> <size android:height=”40dp” android:width=”40dp” /> <solid android:color=”@android:color/transparent” /> </shape> </item> <item android:drawable=”@drawable/scrubber_control_normal_holo”/> </layer-list> So basically changing the size of shape will stretch drawable, the shape is transparent so it won’t be visible. … Read more

Flutter: Is it somehow possible to create App Widgets (Android) and Today Extensions (iOS)? [duplicate]

There is no guide or docs showing how to implement a App Widget for a flutter app. It is definitely possible to implement a app widget with native code. Just create a flutter project and open the android part with android studio, just implement your home screen widget, it’ll work like a charm. I just … Read more

Android getMeasuredHeight returns wrong values !

You’re calling measure incorrectly. measure takes MeasureSpec values which are specially packed by MeasureSpec.makeMeasureSpec. measure ignores LayoutParams. The parent doing the measuring is expected to create a MeasureSpec based on its own measurement and layout strategy and the child’s LayoutParams. If you want to measure the way that WRAP_CONTENT usually works in most layouts, call … Read more

SearchView.OnCloseListener does not get invoked

I ran into same problem on android 4.1.1. Looks like it is a known bug: https://code.google.com/p/android/issues/detail?id=25758 Anyway, as a workaround i used state change listener (when SearchView is detached from action bar, it is also closed obviously). view.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { @Override public void onViewDetachedFromWindow(View arg0) { // search was detached/closed } @Override public void onViewAttachedToWindow(View … Read more

How to add views dynamically to a RelativeLayout already declared in the xml layout?

Add the rule RelativeLayout.RIGHT_OF for the second added Button LayoutParams: // first Button RelativeLayout rLayout = (RelativeLayout) findViewById(R.id.rlayout); RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); Button tv1 = new Button(this); tv1.setText(“Hello”); tv1.setLayoutParams(lprams); tv1.setId(1); rLayout.addView(tv1); // second Button RelativeLayout.LayoutParams newParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); Button tv2 = new Button(this); tv1.setText(“Hello2”); newParams.addRule(RelativeLayout.RIGHT_OF, 1); tv2.setLayoutParams(newParams); tv2.setId(2); rLayout.addView(tv2);