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
0 answers

Listen to statusbar/navbar visibility in fullscreen mode?

In my activity I go fullscreen to hide the status bar and navigation bar using this code: window.apply { decorView.systemUiVisibility = ( View.SYSTEM_UI_FLAG_LAYOUT_STABLE or…
Bencri
  • 1,173
  • 1
  • 7
  • 22
1
vote
1 answer

Changing layout element attributes in Custom AlertDialog Class

So I am building a really basic app. I'm using an alert dialog to show the user whether they've won or not. What I have done is that I created this class : public class WinLoseDialog { Activity activity; AlertDialog dialog; TextView text; …
Arnav Mangla
  • 82
  • 1
  • 7
1
vote
0 answers

Android Espresso. Test views that place in ViewGroup

I have an LinearLayout, in which I add and remove view programmatically. But I add not a particularly view, instead I add ConstraintLayout with other view, that I need to test. So here in ConstaintLayout places EditText, which I want to test, type…
1
vote
3 answers

Guidelines Inside ScrollView - use Viewport %

I would like to add content to an app that starts at about 70% down vertically and can be scrolled upwards to cover the top 70% views. I thought of using two children ConstraintLayout's inside a parent ConstraintLayout - the two children would be on…
user1114
  • 1,071
  • 2
  • 15
  • 33
1
vote
0 answers

Android surfaceview native ui component rendering problem in react native

In one of my react native project I needed to add a custom surfaceview where we will render some content. So before I add anything to the main project I created a test react native project. Here is my custom surfaeview. It's pretty straight forward.…
Rupom
  • 11
  • 3
1
vote
1 answer

Composable disappears after clicking on button, if there is a SurfaceView in the background

setContent { AndroidView(modifier = Modifier) { SurfaceView(it).apply { holder.addCallback(this@MainActivity) } } Column { Button(onClick = {}) { Text(text = "Button") } …
1
vote
1 answer

Does Compose lose more performance than Android View system when updating partial areas?

I noticed that Compose on Android actually implemented by AndroidComposeView, When compose state changes and composable function starts recomposing, AndroidComposeView.invalidate() will be called from the layout node layer (At least for now in…
1
vote
0 answers

autofill not finding view id in android app

We have an app where we are asking for login and password inside a fragment. It used to work like a charm with autofill. The password manager worked great with it, autofilling passwords already entered by the user. But recently, when selecting the…
1
vote
0 answers

Synchronizing foreground service with PlayerView UI?

I'm trying to assign my PlayerView to the SimpleExoPlayer that is initialized in my foreground service. I tried using onBind(), but whenever I bind the context to the service the SimpleExoPlayer is no longer able to play when I exit the app (I…
1
vote
1 answer

Setting the screen range on the Android canvas

I implemented a canvas for drawing on Android, but the drawing view fills the screen. I want to adjust the size of this screen. What should I do? Once I set MyView to show with setContentView in oncreate method. MainActivity.java MyView view = new…
1
vote
2 answers

windowInsetsController vs windowInsetsControllerCompat? I can only access the former

So i was watching this tutorial by google today here https://youtu.be/jal0l48OTxk and i figured that doing myCanvasView.systemUiVisibility = SYSTEM_UI_FLAG_FULLSCREEN is now deprecated and i need to use windowInsetsController instead. First…
Sbeve
  • 91
  • 2
  • 16
1
vote
1 answer

How to reference views (e.g. Spinner value) from ViewModel

I'm trying to reference a Spinner view and its value from HomeViewModel that is populated with a list of strings in the HomeFragment and declared in the XML layout file of the fragment. This spinner contains a list of languages. Depending on which…
1
vote
1 answer

Android, does layoutParams points on parent view and not the view itself?

I got a problem when trying to update dynamically the layoutParams of a view. The view to update is a ConstraintLayout, and I want to dynamically change it's app:layout_constraintDimensionRatio property. The fragment XML :
Doubidou
  • 1,573
  • 3
  • 18
  • 35
1
vote
2 answers

Button with progress bar android

I am trying to create a custom button with progress bar inside of it in Android. The button should have 2 states: Normal and Loading. In Normal state it should show a text while in Loading state it should show a centerred circular progress indicator…
1
vote
1 answer

RecyclerView getChildCount and LinearLayoutManager.getItemCount

What is the difference between the RecyclerView.getChildCount() and LinearLayoutManager.getItemCount()? If I understand correctly the former is the number of views created and being recycled while the later is the number of items in the array…
Jim
  • 3,845
  • 3
  • 22
  • 47