Top "Android-view" questions

Questions regarding Views in Android.

Is there an easy way to add a border to the top and bottom of an Android View?

I have a TextView and I'd like to add a black border along its top and bottom borders. I tried …

android border android-view textview
Android basics: running code in the UI thread

In the viewpoint of running code in the UI thread, is there any difference between: MainActivity.this.runOnUiThread(new Runnable() { …

android android-asynctask android-view android-ui
Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work

I want my DatePicker and the button to be invisible in the begining. And when I press my magic button …

java android android-layout android-view android-datepicker
What is the main purpose of setTag() getTag() methods of View?

What is the main purpose of such methods as setTag() and getTag() of View type objects? Am I right in …

android view android-view android-viewholder
Android: View.setID(int id) programmatically - how to avoid ID conflicts?

I'm adding TextViews programmatically in a for-loop and add them to an ArrayList. How do I use TextView.setId(int …

android android-view conflict
Add and Remove Views in Android Dynamically?

How do I add and remove views such as TextViews from Android app like on the original stock Android contacts …

android android-view
Is there an addHeaderView equivalent for RecyclerView?

I'm looking for an equivalent to addHeaderView for a recycler view. Basically I want to have an image with 2 buttons …

android android-view android-recyclerview
How to lay out Views in RelativeLayout programmatically?

I'm trying to achieve the following programmatically (rather than declaratively via XML): <RelativeLayout...> <TextView ... android:id="@+id/…

android android-layout android-view android-relativelayout
Coloring Buttons in Android with Material Design and AppCompat

Before the AppCompat update came out today I was able to change the color of buttons in Android L but …

android button android-view android-button material-design
findViewByID returns null

First of all: yes, I read all the other threads on this topic. And not only those from this site... (…

android android-view