Questions tagged [android-view]

Questions regarding Views in Android. Views may be defined in Android Layout XML or in Java code. Questions using this tag involve general View practices or advice. With regard to specific Views, refer to the info for this tag. For questions regarding layout, use the [android-layout] tag.

Introduction

A View in Android is the display of the data utilized by the application. Views range widely from simple and non-interactive to complex and interactive in many ways. In addition to the Views provided by the SDK, developers have the option to create custom Views. This means that virtually any communication or display to the user may be handled in innumerable ways.

ViewGroups

ViewGroup is a subclass of View, which has the ability to hold other Views. Children Views may be added to the ViewGroup at run-time (in Java code) or may be pre-defined in Android XML. Like Views, ViewGroups may also be extended in the same way. Follow these guidelines for questions regarding ViewGroups:

  • If the ViewGroup is provided by the Android SDK, it should be listed below in Standard Views.
  • If the ViewGroup is a Custom View, use

Standard Views

A wide variety of Views are delivered with the Android SDK for use by developers. These views make up a majority of the Views in a standard application. Each View has its own semantics and behaviors. As a result, it is often more beneficial to use the tags specifically related to those Views. Below is a list of standard views provide within the Android SDK:

Usage: vs.

While Views and layouts work hand-in-hand, questions regarding the two are often very different. These guidelines will help to properly determine which tag to use:

  • If the question refers to the properties used to display the View properly, then use .
  • If, instead, the question refers to the functionality of the View, then is appropriate.
3981 questions
1
vote
1 answer

Checking if finger is over certain view not working in Android

I am working on a paint app with the following layout: For the paint app, I detect touch events on the Canvas using onTouchEvent. I have one problem, I want to also detect touch events in which the user begins the swipe on the root and then hovers…
1
vote
1 answer

How to add a Button (like 'Clear History') below the expanded SearchView (showing 10 recent searches) in Android?

Can anyone please help in how to add a button to the expanded SearchView (placed in ActionBar) below the list of recent search suggestions the SearchView is showing? Since SearchView extends LinearLayout, I have tried to add a button in the layout,…
Akhil
  • 13,888
  • 7
  • 35
  • 39
1
vote
2 answers

How can I make FrameLayout for Video have round corners with Agora?

At the moment, I tried with this but didn't work. val surfaceView = RtcEngine.CreateRendererView(baseContext) surfaceView.apply { clipToOutline = true clipBounds = Rect(15,15, 15, 15) outlineProvider =…
c-an
  • 3,543
  • 5
  • 35
  • 82
1
vote
1 answer

How can I make Local view round in Agora?

I created customed RoundSurfaceView, and then, val surfaceView = RtcEngine.CreateRendererView(baseContext) as RoundSurfaceView and then, I got this error. java.lang.ClassCastException: io.agora.rtc.video.ViEAndroidGLES20 cannot be cast to I expect…
c-an
  • 3,543
  • 5
  • 35
  • 82
1
vote
2 answers

Is there any APIs that applys the same thing into different views in Kotlin?

I have 3 buttons that has the same animation. let's call them, button1, button2, button3. button1 .animate() .setDuration(initialTime) .setInterpolator(DecelerateInterpolator()) .alpha(1f) .start() button2 .animate() …
c-an
  • 3,543
  • 5
  • 35
  • 82
1
vote
1 answer

Android: scroll a list of items such that only some are visible and the size of the visible items are dependent on their location

To ground this question, lets assume I have 10 TextViews with text numbered between 1 and 10. At any given time, I would like exactly three of the TextViews to be visible on the screen (no partial). For example, 1,2,3 might be visible or 5,6,7. I…
HXSP1947
  • 1,311
  • 1
  • 16
  • 39
1
vote
1 answer

Top-level Layout in Android XML is ALWAYS FrameLayout?

I was trying to set height of ConstraintLayout programmatically and I intended to use ConstraintLayout.LayoutParams. ConstraintLayout is a top-level layout in this XML. but I had weird experience when I set height from old to new with…
1
vote
1 answer

Android Studio 'android.content' and 'android.view' sub classes are missing

In Android Studio packages android.content and android.view sub classes are missing, sub claases like View Context LayoutInflater i tried Invalidate Cache/ Restart Rebuild Project Clean Updated All Dependencies but no one worked for me. enter…
1
vote
2 answers

How to set adapter in Fragment

I've got a Fragment whose onCreateView() callback returns a custom View. The View contains a GridView that I'd like to set an adapter on. Before I switched to using Fragments, I would simply find the GridView by Id and then set the adapter. For…
1
vote
0 answers

Getting Started with ExoPlayer

I am working on my first Android application using Kotlin. The activity is simple, connect to an audio stream from a given URL and allow the user to pause, resume, and/or stop the stream. I've been able to connect to and play the requested audio…
1
vote
1 answer

Update ProgressBar outside of recycler view adapter android Kotlin

I want update progress bar in parent activity where recycler view is located.when user clicked on each radio buttons add a number to progress bar I have done it but I don't know how can I pass data from recycler view adapter to parent…
1
vote
0 answers

How to implement a horizontal moving joystick, Android

How to implement a horizontal moving joystick, that can be moved from left to right. The controller should return back to its initial position (center) on release, Also, I should be able to fetch the values live as the controller moves left or…
1
vote
1 answer

Taking screenshot of Webview (AndroidView) in Jetpack Compose

I am planning to replace all the fragments in my project with composables. The only fragment remaining is the one with a WebView in it. I need a way to get it's screenshot whenever user clicks report button Box(Modifier.fillMaxSize()) { …
Shreyash.K
  • 487
  • 4
  • 14
1
vote
0 answers

Detect when no view is focused in Android activity

Is there a way to get an event in my Android activity when the focus is cleared from all views in it (ie. getCurrentFocus() will return null)? We have an Android app that combines a GLSurfaceView with EditText objects positioned on top of it (not as…
O'Rooney
  • 2,878
  • 2
  • 27
  • 41