Top "Android-view" questions

Questions regarding Views in Android.

Get fragment's container view id

I have a fragment added using transaction.add(R.id.content, fragment, null); and I need to start new fragment …

android android-fragments containers android-view
Can I use view pager with views (not with fragments)

I am using ViewPager for swiping between Fragments, but can I use ViewPager to swipe between Views simple XML layout? …

android android-fragments android-viewpager android-view
Android AppCompat 21 Elevation

Is there any way to add elevation to a View in pre-lollipop devices without wrapping them in a CardView?

android android-view material-design
Android View.getDrawingCache returns null, only null

Would anyone please try to explain to me why public void addView(View child) { child.setDrawingCacheEnabled(true); child.setWillNotCacheDrawing(false); …

android android-view
Get margin of a View

How can I get the margin value of a View from an Activity? The View can be of any type. …

android android-layout android-view
What does the LayoutInflater attachToRoot parameter mean?

The LayoutInflater.inflate documentation isn't exactly clear to me about the purpose of the attachToRoot parameter. attachToRoot: whether the inflated …

android android-layout android-view layout-inflater
Android : Draw Circle With Text Inside

I need to draw three circles in my fragment ,the circles differ in size, I refer this link The result …

android android-layout android-canvas android-view
When it's necessary to execute invalidate() on a View?

My answer to this question was just accepted but I started to wonder when exactly one needs to invalidate() a …

android android-imageview android-view
onKeyDown() issue

I would like to create a photo/video capture application. I have created a CaptureView class which extends SurfaceView and …

android android-view onkeydown
How to use Percentage for android layout?

How can we use percentage values for android view elements? something like this <TextView android:id="@+id/" android:layout_…

android android-view android-preferences android-styles