Is it a bad practice to use negative margins in Android?

Demo of negative margin:                           The scenario Overlapping views by setting a negative margin to one of them so that it invades the bounding box of...

How to open a second activity on click of button in android app

I am learning to build android applications and I need some specific help. I can't seem to get my head around which bits of template code I am required to change, and which bits are static. In the...

Android 3 Layers Layout with listview

I'm trying to have a layout with 3 layers. I'm using 3 linearlayouts in which one of it is an listview, but my bottom Linearlayout does not appear on screen. I need: On Top: Horizontal Linear...

You need to use a Theme.AppCompat theme (or descendant) with this activity

Android Studio 0.4.5 Android documentation for creating custom dialog boxes: http://developer.android.com/guide/topics/ui/dialogs.html If you want a custom dialog, you can instead display an...

Android toolbar menu is not showing

I'm trying to add a menu to the ToolBar. onCreateOptionsMenu method of my Activity is called, but no menu appears. This is dashboard.xml (from menu folder) <?xml version="1.0"...

Changing TabLayout icons on left, top, right or bottom in com.android.support:design:23.1.0

I'm pretty new to android development. So bear with me. I've been trying to align the icon and text in same line in com.android.support:design:23.1.0 for a day. Apparently in...

Error inflating class ImageButton

I have an app which has fragment and image button on that. The problem is it's working on and above 5.0 but not below 5.0. The min sdk version is 17. Not getting what's wrong here. I am getting 2...

Set state of BottomSheetDialogFragment to expanded

How do you set the state of a fragment extending BottomSheetDialogFragment to expanded using BottomSheetBehavior#setState(STATE_EXPANDED) using the Android Support Design Library...

Is there a way to extract a string with an automatically generated resource name for a java file in Android Studio?

In Android Studio, Alt + Enter > "Extract String Resource" in a java file will open the following window: Please note that the Resource name field is blank. However, the window will be like the...

Android spinner Data Binding using XML and show the selected values

I am using the new android data binding and it works great. I am able to perform data binding using EditText, TextView, Radio and checkbox. Now, I am not able to do the databinding in...

make an ImageView with rounded corners?

rounded corners of cardview I want to make the interface as shown above. The images are not fixed, which means I can transfer images to other. I want to use pakage in xml file. Something...

Shared Element Transition not working

I have made a github project with just the issue. You can see it / clone it / build it from here: https://git.io/vMPqb I am trying to get shared elements working for a Fragment transition. There...

Preference Screen Custom Layout only works with second click

I have a preference screen using a 'custom layout': android:layout="@layout/currencycodes" This issue is it fails to bring up the layout on the first attempt. As you see from the animated gif...

Items Don't Stay Where Placed With Drag Drop Feature in Android Studio

So Android Studio has the drag/drop feature in the design tab. I am able to place the elements where I want them, and the layout looks great on the screen. However, when I go to run the app...

Emulator can't find 'Linux version ' string in kernel image file

I was building AOSP for the Nexus Player and after successful compilation I tried to run the emulator and the message I received is: emulator: ERROR: Can't find 'Linux version ' string in kernel...

imageview works only in Android Studio preview, but not on device or emulator

I've a problem with an image in an activity. For some reason the ImageView is visible in the Android Studio preview, but not when I build it on device or emulator. In any other activity it's...

Android Studio Error:Execution failed for task ':app:compileDebugJavaWithJavac'

I updated Android Studio and SDK tools to the latest version and now I got this error. I have updated Google Services and firebase dependencies accordingly. I tried to clean and rebuild the...

Error: Could not parse the Android application Module's Gradle Config

I've been trying to setup Firebase in my Android project. Problem is, I've been getting this error: Could not parse the Android application Module's Gradle Config And I really can't solve...

Unconditional layout inflation from view adapter warning

I am using GridView in my alert dialogue with below codes.its giving me error called in title. My codes and more required information is like below. private void showGotoPageDialog() { ...

ExoPlayer - changing thumb in DefaultTimeBar

As I understand from releas note of version 2.4.0 ExoplayerSeekBar was replaced by DefaultTimeBar. https://github.com/google/ExoPlayer/blob/dev-v2/RELEASENOTES.md As I can seen, as on 19Feb2017:...

How to make Constraint Layout Guideline in center

I have 3 Guideline in Constraint Layout. One is in left with 16dpleft margin. Second is in right with 16dp right margin. But I want another Guideline which will be in center. Suppose If I make...

cannot locate symbol "ANativeWindow_fromSurfaceTexture" referenced by

Execute the application exception occurs cannot locate symbol "ANativeWindow_fromSurfaceTexture" referenced by System.loadLibrary("aaa"); In the aaa.so file used ANativeWindow_fromSurfaceTexture...

Error in existing project - XML document structures must start and end within the same entity

I have opened an existing project and got Error. How to fix it? I have tried lots of efforts to know What is the error and why it is happened when i opens an existing project in android...

How to disable night mode in my application even if night mode is enable in android 9.0 (pie)?

I created my application before the android pie has been released, in every layout I put android: background = "white" it works fine in every device, but when my brother installed the application...

How to Completely Remove an Android Layout from Android Studio

I'm building an app in Android Studio and I accidentally created a base LoginActivity template but then deleted it because I wanted to make my own. Now, when I try creating another activity with...

View binding with include layout not working

I want to use view binding to bind the view in include layout. I had given the included layout with an id 'topBar' but still failed to access the views inside of it. And I try to use Android...

Jetpack Compose, centering text without font padding?

I'm struggling with vertically centering text in Jetpack Compose version alpha-11. It appears that my font has a significant amount of padding and I'm unable to find a way to disable it. This has...

Create timeline jetpack compose

I am trying to create a timeline with Jetpack Compose and I see that it is literally impossible to create the lines for each row without spaces and with dynamic height depending on the text. I...

How to use only light mode in aplication? Android Studio

I'm developing a program, but as I have the mobile phone in the dark theme, some textViews have a white letter and don't appear due to the color that is placed on them. But when I switch the phone...

Convert GPS Coordinates to Match Custom 2d outdoor layout Image

I don't know if this is possible, but I am trying to take the image of a custom outdoor football field layout and have the players' GPS coordinates correspond to the image xand y position. This...