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.

Filter by
Sorted by
Tagged with
1 vote
2 answers
49 views

Make transparent part of the view pass over touches and keep touches on a visible part

There is views container (blue) which is set for the almost full width of the screen. Sometimes views which are displayed inside this container require not to have the full width of the container - ...
bene25's user avatar
  • 590
0 votes
0 answers
34 views

Adding N number of textview dynamically inside view holder item while the recyclerview is setting up

In this part of my app, I am trying to add n (number) of textview based on number of orders to the linearlayout inside recycler view item, but the problem is textviews some times not showing, and I ...
Dr Mido's user avatar
  • 2,438
0 votes
1 answer
21 views

Use seekbar on Wear OS without dismissing the frame

The problem I am developing an IoT application for Wear OS, and I would like to set the brightness of a light with a seekbar. However, moving the seekbar from left to right causes the Fragment to ...
Zan's user avatar
  • 11
0 votes
2 answers
45 views

How to take input for timer with 11 buttons

I am new to android development . I am trying to make a timer app . My UI has 11 buttons from 0-9 , a 00 button and a backspace button . The initial format of my textview will be like "00h 00m ...
codec123's user avatar
0 votes
0 answers
34 views

AndroidView() not calling the update block

I have the following setup: @Composable fun PieChart( updateChart: (chart: PieChart) -> Unit, updateEvent: State<List<Transaction>>, ) { val update = updateEvent.value ...
Ait-Gacem Nabil's user avatar
0 votes
0 answers
18 views

How I get hints from IntelliJ on ViewBinding class fields when this class is not generated yet?

I was playing around Kotlin and learned about ViewBinding and how it works. It seems quite easy for me but there is one thing I don't understand. I edit activity_main.xml and instantly get hints on ...
Nikolai's user avatar
0 votes
0 answers
15 views

Cause: toDerInputStream rejects tag type 0

I have a problem on android studio. It keeps giving this error and i don't know why. I have a blank view and activity with just the default code and it still shows this on every activity or project i ...
Lord of Legends 107's user avatar
0 votes
1 answer
16 views

Which device spec determines the space Views have

Forgive me if this is a stupid question, I am a beginner. Suppose I have two devices, Device A is smaller than Device B, both physically and in terms of pixel density. On Device A, one of my text ...
Wade Byron Profe's user avatar
0 votes
1 answer
58 views

I am updating the ViewModel using data binding, but the View is not getting updated

If I update the ViewModel, the View that consumes this data should be updated automatically right? What am I missing? This is the MainActivity class: class MainActivity : AppCompatActivity() { ...
Rajneel Anuraj's user avatar
2 votes
0 answers
38 views

EditText-backed TextField in Compose

I want to implement Image keyboard support into a Compose app. As this two-year-old issue shows, there are currently no public APIs to achieve it. Although TextInputServiceAndroid class has a fun ...
Calamity's user avatar
  • 740
0 votes
1 answer
24 views

Android complicated schematic view

I need to make an interactive research fragment for my game and got an SVG file exported from Figma with all the rects, circles, texts, etc. It must be scaleable (zoomeable via touch input), draggable ...
Nikitiy's user avatar
  • 37
0 votes
0 answers
34 views

Why does the AndroidView with Compose always have a white background color?

I am working on an Android project in which I have to use an Android View in Compose. However, when I used it, the Android View always has a white background. Can somebody help me? My code: ...
Michael Lee's user avatar
0 votes
0 answers
117 views

ExoPlayer issue using AndroidView in LazyColumn Compose

I am trying to have a videoplayer (using ExoPlayer occupying half of the screen's height) at the top of the LazyColumn and list of items below the video player using compose. The list of items ...
srinu's user avatar
  • 1
0 votes
0 answers
38 views

Android: View.isAttachedToWindow() is not in sync with actual state

View new_overlay = new View(this); wm.addView(new_overlay, params); new_overlay.isAttachedToWindow(); //false here I expected isAttachedToWindow() to be true after addView(). I haven't found ...
yorklift's user avatar
0 votes
0 answers
19 views

How do I create and store notes, photos, and events for a calendar app?

I'm a 16-year-old who's learnt a few other programming languages and has now begun learning Kotlin for Android app development. I want to create a calendar app in which clicking on a date in a ...
Nandan Praveen's user avatar
3 votes
1 answer
177 views

Android System Gesture Exclusion area persists after leaving the screen

I use setSystemGestureExclusionRects() method to set a single exclusion Rect inside onDraw method of my custom View, which resides inside a Fragment. It works. However, after I navigate back from that ...
Vasiliy's user avatar
  • 16.2k
0 votes
0 answers
32 views

How does Jetpack Compose overcome double measurement problems that were present in the View layouts?

Many Android layouts from the View package (RelativeLayout, ConstraintLayout, LinearLayout with weights) are notorious for double-taxation problem that required their child views to be measured twice, ...
olshevski's user avatar
  • 4,981
0 votes
0 answers
12 views

RecyclerView button item clickListener and LongPressClickListener combine in TouchListener android

I have a recyclerView with several view types. One of those is an EditText with a button. This editText shows a Number which represents number of months and the Button next to it is used to increase ...
james04's user avatar
  • 1,640
0 votes
1 answer
38 views

Do I need to use "MeasureSpec.makeMeasureSpec" with "MeasureSpec.UNSPECIFIED" value?

Is there any difference between 2 measure function calls? view.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED) view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), ...
Veniamin's user avatar
  • 774
0 votes
0 answers
18 views

What is the correct way and place to get parent view's width and height from within a custom view? [duplicate]

My custom view extends the AppCompatImageView class and it needs to know its parent view's dimensions. The following code is used: val w = (parent as ViewGroup).width val h = (parent as ViewGroup)....
Crocodile's user avatar
  • 5,724
0 votes
1 answer
43 views

Background colour set in Android view throwing error

I want to show the Toast in my Android app without adding additional parameter/arguments/input to the existing function "ShowToast" since ShowToast is already used in many java files already....
SaAsh Techs's user avatar
0 votes
0 answers
101 views

Emoji2 emojipicker inside compose ModalBottomSheet doesn't scroll

I need to use the emoji2-emojipicker from androidx which is made like so with XML views: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width=&...
Giuliopime's user avatar
1 vote
3 answers
63 views

generic function to traverse a View hierarchy and find contained Views of a specific type

My outer problem, in Java 1.8, is I want to traverse (or spider) a tree of View objects and call a callback on each one of a specific type. Here's an example caller: findEachView(main....
Phlip's user avatar
  • 5,273
0 votes
0 answers
24 views

Progress bar never shows

Caveat: I am a bit of a neophyte on Android, working with someone else's code. The app I'm working with does a long background process and currently appears to just "hang" while it's working....
KiraHoneybee's user avatar
0 votes
2 answers
41 views

Thread.sleep on main thread causing view changes to be skipped?

I'm trying to add a red flash to my application when some event occurs. Using the windowManager, i've created and added a simple view that just fills the canvas with red, and initializes the opacity ...
user3504410's user avatar
0 votes
2 answers
36 views

Create ConstraintLayout with 2 buttons and EditText fails programatically

I am trying to re-create a screen from XML to code for some reason. This is what I want my screen to look like: So pretty simple: Two buttons on each side (should actually be images but it's fine ...
J. Doe's user avatar
  • 12.1k
0 votes
1 answer
72 views

Recycler items are not shown when creating programatically the UI

For some reason, I don't want to use XML's and I just want to create my UI programmatically. I now have the issue that my views are not shown on the screen, no matter how many elements I supply. This ...
J. Doe's user avatar
  • 12.1k
0 votes
0 answers
28 views

Android: How to show partial transparent overlay but still send all events to views below

I want to show a partial translucent overlay through the entire lifecycle of the app. I also want the overlay NOT to consume any events and pass the events down. I am able to draw the overlay but ...
rysv's user avatar
  • 2,476
0 votes
1 answer
193 views

how to pass the token in web page while displaying in android app (Jetpack compose)

I am trying to load Training page in my android app. Only authorized user can access the Training page which means it requires token to load this page. Problem is when I am trying to load the Training ...
Dinesh Sarma's user avatar
0 votes
0 answers
21 views

How to know when a layout with nested RecyclerView is completely rendered?

I want to receive a callback when my layout is completely rendered. My layout contains multiple nested RecyclerViews. Here is what I tried: OnGlobalLayoutListener on the fragment view: Returns ...
android_eng's user avatar
  • 1,370
0 votes
0 answers
37 views

Touch events are not working on Xiaomi and Vivo devices ,after adding view on window manager in android?

I am working on edge lightning application in android , where I have to add view on Window Manger to give lighting effect across edges when enabled. In samsung and pixel devices it working fine , ...
Shubham Kumar's user avatar
0 votes
1 answer
43 views

How to crop imageProxy

I want to crop ImageProxy, In order to analyze data only in preview bounds. I try so many things, And here is what I found, I just create custom view for overlay, that contains only ConstraintLayout ...
Nika Mgaloblishvili's user avatar
0 votes
0 answers
16 views

How to render Video on Software Layer in Android

I have a use-case where I need to draw some paths on Android Canvas of a ViewGroup in a ViewGroup whose hierarchy also contains a Video. As per https://developer.android.com/topic/performance/hardware-...
Sourabh's user avatar
  • 545
1 vote
2 answers
78 views

Expand two TextViews next to each other

I would like to put two TextViews next to each other and let both of them expand depending on their contents. The contents of both TextViews are fully dynamic and unpredictable, therefore I want the ...
Andrzej Zabost's user avatar
0 votes
1 answer
30 views

Android: How to set view to scroll away while positioning it between two pinned views?

I have a fixed toolbar, a view with layout_scrollFlags="scroll", a fixed view for filtering and a recycler view, in this respective order from top to bottom in a CoordinatorLayout. This is ...
Mirian Fonkam's user avatar
0 votes
0 answers
33 views

flutter with AndroidView native player change orientation show black screen for a while

I'm coding with Android native player, and I want to change orientation with OrientationBuilder, when I change it to landDirection, I get a black native view. SystemChrome.setPreferredOrientations([...
Stan He's user avatar
0 votes
0 answers
95 views

How to overlap lazy layout items in jetpack compose

i am trying to overlap first item in LazyVertivalGrid over second item but i have no idea how can i achieve it. LazyVerticalGrid( columns = GridCells.Fixed(4), state = state, modifier = ...
Shivii44's user avatar
1 vote
1 answer
104 views

How to remove unwanted padding from self made canvas view in Android

I have a custom made Canvas object in Android (thermometer) that unfortunately has a padding around it that I want to get rid of as it makes it quite difficult to position it within the layout. Here ...
VanessaF's user avatar
  • 514
0 votes
1 answer
810 views

Android Material 3 TopAppBar custom color theme

Goal Create an ActionBar with a custom color theme differing from the color theme applied by the global theme + preserve elevation coloring if content is scrolled Minimal Working Example (Colors and ...
citizen_code's user avatar
0 votes
0 answers
23 views

How to make graphview in android stay still when i add series to it?

Creating graph: GraphView graph = (GraphView) (findViewById(R.id.graph)); graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.rgb(0, 68, 173)); graph.getGridLabelRenderer()....
Даниил Белковский's user avatar
0 votes
0 answers
9 views

Can not set padding programatically to circular side in RadioButton

Im creating RadioButton with RTL layout so that the circle drawable will be on the right side. I need to create it programatically because it needs to dynamically added. But i found a problem when ...
wiryadev's user avatar
  • 1,109
1 vote
0 answers
36 views

How to Preview SciChartSurface in Compose?

I’d like to preview SciChartSurface in Compose using @Preview annotation. I am getting error java.lang.NoClassDefFoundError: Could not initialize class com.scichart.drawing.canvas.RenderSurface$d @...
yoman796's user avatar
2 votes
0 answers
183 views

How to apply theme to text in AndroidView in Jetpack Compose app

Please, how do I get text color of html string formatted with AndroidView() to change as the application theme changes programmatically from Light to Dark theme and vice-versa? Thanks in advance! ...
Trailblazer's user avatar
0 votes
2 answers
249 views

Self-made canvas view in Android is not correctly displayed (any more)

I have a strange problem. I spent quite some time designing a self-made canvas view in Android which should be a water tank (that is the rim which insert via R.drawable.hot_water_tank_container) and ...
VanessaF's user avatar
  • 514
0 votes
0 answers
39 views

How to get coroutineScope If i just have a handle to view

We have extended android.content.res.Resource class and have our - public String getString(int id) throws NotFoundException { String value = null; try { value = getStringFromRepository(...
Vikas Pandey's user avatar
  • 1,115
1 vote
1 answer
286 views

Jetpack Compose with WindowManager - Cannot start this animator on a detached view

I am currently working on an Android library called Floating-Bubble-View, this library helps create a floating view on the screen. Recently, I added support for Composable and with the help of a ...
TorryDo's user avatar
  • 55
0 votes
0 answers
61 views

Android WindowInsets API: how to achieve View.SYSTEM_UI_FLAG_LOW_PROFILE behavior?

I want to make the navigation icons (bar) dim, because they are to bright and distract the user from the application content. At the same time I don't want to hide the navigation bar completely. The ...
frumle's user avatar
  • 603
1 vote
0 answers
221 views

Kotlin - Show error message when data is null

I'm trying to make an app that gets data from TMDB API with retrofit. I use Paging Source and Flow to get the movies from the api. MoviesViewModel.kt class MoviesViewModel: ViewModel() { val ...
t3nsa's user avatar
  • 680
2 votes
1 answer
61 views

How to get the position of a view relative to its parent including padding?

I have a FrameLayout with a LinearLayout child. I am updating the position of the LinearLayout by setting its bottom padding to 100. However when I get the OnLayoutChange callback, the bottom and ...
Hudson Miears's user avatar
0 votes
1 answer
268 views

Lazy Column with Android View in it lags a lot when scrolling

I have a lazy column with items where each item has its own custom Slider which is implemented using the AndroidView(). The problem is that the slider has its onDraw() Method overridden. Since the ...
Nishan Khadka's user avatar

1
2 3 4 5
80