android-view

Multiple layers of shadows in android recyclerview elevation

筅森魡賤 提交于 2020-02-06 04:16:49
问题 I have a recyclerview with an elevation of 8dp, transparent background and bounds as outlineProvider. clipToPadding is set to false on the parent relativelayout. I am facing a weird issue w.r.t the shadow cast by the recyclerview elevation. The shadow seems to cover up the edges of the recyclerview or there is an extra layer between the relativelayout and the child recyclerview (Attached an image reference). What is actually causing this effect? I have searched a lot but could not find any

Dark-text transparent status bar with opaque navigation bar

自闭症网瘾萝莉.ら 提交于 2020-02-03 05:38:10
问题 Wait, it is not a duplicate A similar question has been asked here, but not addressing dark-text status bar. What I want to do I want to achieve 3 things at the same time : Transparent status bar (Not hiding it!) Dark-text status bar Opaque (or black) navigation bar (which does not let activity content inflate underneath it ) What I have tried The solution getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); can only

layout_gravity center along with layout_marginRight issue

五迷三道 提交于 2020-02-02 16:26:07
问题 I am not able to get reason why there is difference in below two views, only difference is layout_gravity center is missing in second one <?xml version="1.0" encoding="utf-8"?> <View xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_gravity="top|center" android:layout_height="10dp" android:layout_marginRight="100dp" android:background="@android:color/holo_red_dark" /> <?xml version="1.0" encoding="utf-8"?> <View xmlns:android="http:/

Overriding onSaveInstanceState

孤者浪人 提交于 2020-02-02 10:59:25
问题 I'm trying to come to grips with the onSaveInstanceState method in class View (not the one in class Activity). That method does return a Parcelable. I derived my own View from ViewGroup and overrode that method to save my own state. But when the state was to be saved I got an exception: java.lang.IllegalStateException: Derived class did not call super.onSaveInstanceState() That is true enough, but simply calling that method doesn't seem enough to me. So how should I do this? If the method

Overriding onSaveInstanceState

让人想犯罪 __ 提交于 2020-02-02 10:57:10
问题 I'm trying to come to grips with the onSaveInstanceState method in class View (not the one in class Activity). That method does return a Parcelable. I derived my own View from ViewGroup and overrode that method to save my own state. But when the state was to be saved I got an exception: java.lang.IllegalStateException: Derived class did not call super.onSaveInstanceState() That is true enough, but simply calling that method doesn't seem enough to me. So how should I do this? If the method

MeasureSpec returns a 0 value - onMeasure()

本小妞迷上赌 提交于 2020-02-02 06:16:24
问题 I have searched for answers regarding this but haven't found a solution. So i am requesting help here. I am creating a custom View. I have overridden onMeasure. Code given Below. @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ super.onMeasure(widthMeasureSpec, heightMeasureSpec); int widthSize,heightSize; int measureWidthSpec = MeasureSpec.getMode(widthMeasureSpec); int measureHeightSpec = MeasureSpec.getMode(heightMeasureSpec); widthSize = getCircleWidth

How do I know the ID's of views if I am inflating a view multiple times in the same parent on button click?

為{幸葍}努か 提交于 2020-01-26 01:47:49
问题 I have a difficult situation, let me put it this way, I want the user to use my 3 text-fields to set data for alarm and after filling in the information, I give him an option to set another alarm for this purpose I use a button. I have three table rows in a table layout which are defined in a child.xml file and every element has an Id set. In my activity, I inflate child.xml multiple times on button click event and I am able to successfully inflate it as many times as I want. But my problem

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;

Dialog with custom view background

試著忘記壹切 提交于 2020-01-20 08:35:27
问题 Solved: see answer below I am sub-classing Dialog to create a dialog with a custom background. I have added a subclass View to the Dialog and it is drawing the bitmap background and layout correctly. But the buttons will not respond to any touch events. I suspect the LinearLayout has to be loaded in the Dialog class, but I think I have to load it in the view class to draw on top of the bitmap. I am totally new to Android dev, so I apologize for the question. Here is what I am doing: public

Dialog with custom view background

旧城冷巷雨未停 提交于 2020-01-20 08:34:54
问题 Solved: see answer below I am sub-classing Dialog to create a dialog with a custom background. I have added a subclass View to the Dialog and it is drawing the bitmap background and layout correctly. But the buttons will not respond to any touch events. I suspect the LinearLayout has to be loaded in the Dialog class, but I think I have to load it in the view class to draw on top of the bitmap. I am totally new to Android dev, so I apologize for the question. Here is what I am doing: public