android-layoutparams

Cannot resize linear layout children in android react native module

拥有回忆 提交于 2019-12-03 12:17:59
Full code here Video of correct behavior in java and incorrect in react native here I have modified a linear layout to respond to touch by resizing the left child while the right child takes up the rest of the space, simulating a horizontal scroll that can be 'opened' or 'closed' using the following code LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) leftView.getLayoutParams(); //Log.d("ll","width " + newWidth); lp.width=newWidth; leftView.setLayoutParams(lp); In react native, touch is still calling this method and logging the expected values, but the size of the children is not

Android Windows: When and how are they created?

时间秒杀一切 提交于 2019-12-03 07:42:28
I have read the standard Windows-related documentation and pawed through a bunch of the source code in an attempt to understand how and when Android Windows are created. I believe I have my arms around it and would like to have it verified or corrected. To my knowledge, there are only two ways to get a handle to a Window object. 1. Activity's getWindow. 2. Dialog's getWindow method. In both of the above cases, you can get a handle to the Window using getWindow and then manipulate the Window using the handle. Windows can also be created by the use of WindowManager's addView method, but it isn't

Removing/Adding constraint programmatically in ConstraintLayout

我只是一个虾纸丫 提交于 2019-12-03 05:23:35
I want to remove and add constraint programmatically based on some condition. Here are the screenshots: and I want to remove it like this but in code: so the same effect in want to achieve programmatically and here is the code that I tried: if (advertisements.size() > 0) { //my own condition ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) btnCreateAd.getLayoutParams(); layoutParams.topToBottom = R.id.imvEmpty; //the imageview that is in center of the view btnCreateAd.setLayoutParams(layoutParams); recyclerView.setVisibility(View.VISIBLE); txvMyAdEmptyText

Changing LayoutParams of always visible Chat Heads to not always visible

不想你离开。 提交于 2019-12-01 18:16:58
问题 I am attempting to add a view I am generating via a service. The code I am using is based on Facebook Chatheads which are always visible, regardless of the apps state. They are also displayed above anything else too: I now wish to constrain the chat head to the active app. Specifically I am dealing with a Bad Token Exception whenever I change the Window.LayoutParams from TYPE_PHONE to TYPE_DRAWN_APPLICATION. MY QUESTION: I know that I am required to pass on the correct window token to the

How to change the z-order of window added via WindowManager?

妖精的绣舞 提交于 2019-12-01 09:57:18
Is it possible to specify the z-order of each window ? in the image below each editText are in their own window added via WindowManager. as you can see i have a z-order problem like you see on the picture, the last window added seam to take the higher z-order. So the only way out i find to put a window at the higher z-order is to remove the view from windowManager and then immediately add it again. It's not very optimal solution, because visually the view disappear and reappear on the screen 来源: https://stackoverflow.com/questions/44231597/how-to-change-the-z-order-of-window-added-via

Removing/Adding constraint programmatically in ConstraintLayout

不羁的心 提交于 2019-11-29 04:51:57
问题 I want to remove and add constraint programmatically based on some condition. Here are the screenshots: and I want to remove it like this but in code: so the same effect in want to achieve programmatically and here is the code that I tried: if (advertisements.size() > 0) { //my own condition ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) btnCreateAd.getLayoutParams(); layoutParams.topToBottom = R.id.imvEmpty; //the imageview that is in center of the view

Unknown attribute android:layout_width, layout_height, id, gravity, layout_gravity, padding

蹲街弑〆低调 提交于 2019-11-28 06:08:12
Getting Unknown attribute error on all android tag. In layout XML, Auto suggestion is not showing all attributes (like layout_width, layout_height, orientation, orientation & all others android attributes.) Here is a Snap shot Things i have done to resolve this issue. Clean Build & Rebuild Deleted .idea file Invalidated Caches/ Restart.. option Turn On Power Save Mode. SDk is up to date. In App Level Gridle apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.abhishek.ondemandservice" minSdkVersion 15

Unknown attribute android:layout_width, layout_height, id, gravity, layout_gravity, padding

廉价感情. 提交于 2019-11-27 05:30:36
问题 Getting Unknown attribute error on all android tag. In layout XML, Auto suggestion is not showing all attributes (like layout_width, layout_height, orientation, orientation & all others android attributes.) Here is a Snap shot Things i have done to resolve this issue. Clean Build & Rebuild Deleted .idea file Invalidated Caches/ Restart.. option Turn On Power Save Mode. SDk is up to date. In App Level Gridle apply plugin: 'com.android.application' android { compileSdkVersion 23

How to programmatically set the layout_align_parent_right attribute of a Button in Relative Layout?

萝らか妹 提交于 2019-11-26 05:52:46
问题 I have a relative layout which I am creating programmatically: RelativeLayout layout = new RelativeLayout( this ); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); Now I have two buttons which I want to add in this relative layout. But the problem is both buttons are being shown on the left of the RelatiiveLayout overlapping on each other. buttonContainer.addView(btn1); buttonContainer.addView(btn2); Now I want to know