Difference between setAlpha and setImageAlpha

ImageView.setAlpha(int) has been renamed to ImageView.setImageAlpha(int) to avoid confusion with the new method View.setAlpha(float) introduced in API level 11. View.setAlpha(float) is a general method available on all Views, including ImageView. It applies the specified opacity to the whole view. To achieve this, by default the system creates a temporary buffer (a hardware layer) where the … Read more

java.lang.IllegalArgumentException: pointerIndex out of range Exception – dispatchTouchEvent

There is a bug in 2.1 (Eclair) where the pointer index isn’t checked and is sometimes -1. You can create a custom view that extends ViewPager, override onTouchEvent and wrap the call to super.onTouchEvent in a try/catch. Whilst not a very pretty fix, I remember that it has no side effects (like missed touch events).

Difference between an AppCompat view and a normal Android view

When you are using a Button or an EditText you are actually using AppCompatButton and AppCompatEditText. From the official documentation of the AppCompatEditText. A tint aware EditText. This will automatically be used when you use EditText in your layouts. You should only need to manually use this class when writing custom views

How to use Percentage for android layout?

UPDATE 2018: PercentRelativeLayout and PercentFrameLayout are deprecated. Consider using ConstraintLayout Old Answer: So far Android Support library has limited on where to use this: with RelativeLayout android.support.percent.PercentRelativeLayout with FrameLayout android.support.percent.PercentFrameLayout How to use it? Well, first make sure to include the dependency at build.grade(Module: app) in your android app. dependencies { compile ‘com.android.support:percent:23.3.0’ } Then … Read more

How to disable BottomSheetDialogFragment dragging

There is simpler way of achieving the same after material design 1.2.0 was released. https://developer.android.com/reference/com/google/android/material/bottomsheet/BottomSheetBehavior#setdraggable When calling from BottomSheetDialogFragment: override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val bottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog bottomSheetDialog.setOnShowListener { val bottomSheet = bottomSheetDialog .findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet) if (bottomSheet != null) { val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet) behavior.isDraggable = false } } return bottomSheetDialog … Read more

Controlling view visibility from a resources

This is an old question that has already been accepted, but the following solution may help someone else: If you check res/values/attrs.xml in Android source code, you’ll see the definition of visibility property like this: <!– Controls the initial visibility of the view. –> <attr name=”visibility”> <!– Visible on screen; the default value. –> <enum … Read more

how to set width which is equal to another widget on android

If you use a RelativeLayout you can use the align-attributes: <View android:id=”@+id/separator” android:layout_width=”0dp” android:layout_height=”0.3dp” android:layout_below=”@+id/textView1″ android:layout_alignLeft=”@+id/textView1″ android:layout_alignRight=”@+id/textView1″ android:background=”#ffffff” />

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)