android-layout

Android - move an ImageView on screen (Like dragging)

懵懂的女人 提交于 2020-01-22 10:49:06
问题 I'm trying to create an app that can move an ImageView on your device like dragging and when I put like 75% of the ImageView out of the screen show a Toast for example. I've been reading about MotionEvent and onTouchListener and I've followed this question, but it doesn't convince me. Edit My current code is : public class MainActivity extends AppCompatActivity implements View.OnTouchListener { int windowwidth; int windowheight; private ImageView mImageView; private ViewGroup mRrootLayout;

Set progress bar on top of RecylerView and remove after data is loaded

浪子不回头ぞ 提交于 2020-01-22 07:32:07
问题 I want to have a loading icon that is displayed on top of where a RecyclerView would be, and disappear once the data is finished loading It would look like: Can anyone help me out? I have the code which shows a TextView above the RecyclerView that says "Loading..." and disappears after the data is loaded, but the RecyclerView is still visible. My XML: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/loaderTV" android:text="Loading..." android

Unable to load sqlite database on first run

旧街凉风 提交于 2020-01-22 04:05:08
问题 I have created an app when I install and launch it for first time it closes automatically but when I open it after it works fine. If I clear data of the app it also closes for first time. It shows android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database Can anyone help here is my log 11-22 23:14:56.175 13193-13193/? I/art: Late-enabling -Xcheck:jni 11-22 23:14:56.195 13193-13193/? D/TidaProvider: TidaProvider() 11-22 23:14:56.285 13193-13193

Unable to load sqlite database on first run

爷,独闯天下 提交于 2020-01-22 04:05:04
问题 I have created an app when I install and launch it for first time it closes automatically but when I open it after it works fine. If I clear data of the app it also closes for first time. It shows android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database Can anyone help here is my log 11-22 23:14:56.175 13193-13193/? I/art: Late-enabling -Xcheck:jni 11-22 23:14:56.195 13193-13193/? D/TidaProvider: TidaProvider() 11-22 23:14:56.285 13193-13193

what should i do to run this play again button, app crashes when its pressed(making a tic tac toe game)?

时光怂恿深爱的人放手 提交于 2020-01-22 03:31:25
问题 plz help me out in this problem i tried many changes that were suggested in android studio basically the problem occurs in playAgain function it crashes but it shold clear the images im the imageviews main activity package com.example.xo; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.GridLayout; import android.widget.ImageView; import android.widget.TextView; public class MainActivity

Continuous OTP input with EditText

血红的双手。 提交于 2020-01-22 03:10:13
问题 Here is 4 EditText for input a numeric password. I want it to be like, If first EditText is filled by 1 number then, focus should goes to next EditText and should also work same in reverse manner. So that user can keep entering password from Left most and can also erase same way from Right most. Can someone suggest what can be the best approach to proceed? 回答1: You can use the library Android PinView / OtpView or you can use addTextChangedListener to add a TextWatcher which is called whenever

Making a Custom RadioButton

回眸只為那壹抹淺笑 提交于 2020-01-22 02:50:12
问题 I'm trying to make a custom RadioButton like this: I tried making a RadioGroup with three RadioButton in it with the background of the RadioGroup being a rectangle and the background of the RadioButton would be a blue rectangle when checked and white when not but it doesn't seem to be working. <RadioGroup android:id="@+id/Frequency" android:layout_width="370dp" android:layout_height="40dp" android:background="@drawable/radiorectangle" android:orientation="horizontal" app:layout

TextView - detect if String exceeds available space

给你一囗甜甜゛ 提交于 2020-01-22 02:31:22
问题 Here is my layout RelativeLayout ImageView iv1 TextView toTheRightOf iv1 toTheEndOf iv1 toTheLeftOf iv2 ImageView iv2 RelativeLayout end So TextView is sandwiched between two ImageViews. So everything is displaying exactly as it should. However sometimes the line in the TextView is too long and comes too close to second ImageView. Sometimes extending right into it. I am not looking to change the layout or try to squeeze around anything. What I want to do is detect when the length of the

Android Samsung S I9000 screen size and density issues

£可爱£侵袭症+ 提交于 2020-01-22 02:05:10
问题 I'm having problems with an app on the Samsung S I9000. The buttons on my app are much larger than they should be. In addition, the system is selecting res/values-small/ as a source of values. All in all, it's acting as if the device has a very tiny screen, even though it's supposedly 800x480 (I'm working in landscape mode). In fact, I can improve the situation by changing the values in res/values-small/styles.xml to even smaller font sizes than I was already using. Display metrics are as

How to put elements on top of each other in the same xml layout?

自作多情 提交于 2020-01-21 14:36:59
问题 How can I have more than one button, or a button and a text view in the same location in one layout but one on top of the other? I want to have a button that is hidden most of the time, but occasionally will have a non intrusive popup that will prompt something. The rest of the time there will be a text view there that is a different size. 回答1: Please take a look at RelativeLayouts. They use android:layout_below and android:layout_above to position elements below/above other elements. 回答2: