android-layout

Adding a View to RelativeLayout changes its size

痞子三分冷 提交于 2020-01-15 04:08:33
问题 I have a RelativeLayout called "Dress" with LayoutParams of WRAP_CONTENT. All that is inside it is an ImageView, so it is the same size as the ImageView. When I add one more view to the RelativeLayout in OnCreate, like this: photoSorter = new MultitouchImagesView(this.getApplicationContext()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); ((ViewGroup) findViewById(id.Dress)).addView(photoSorter, params); The

Adding a View to RelativeLayout changes its size

久未见 提交于 2020-01-15 04:08:20
问题 I have a RelativeLayout called "Dress" with LayoutParams of WRAP_CONTENT. All that is inside it is an ImageView, so it is the same size as the ImageView. When I add one more view to the RelativeLayout in OnCreate, like this: photoSorter = new MultitouchImagesView(this.getApplicationContext()); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); ((ViewGroup) findViewById(id.Dress)).addView(photoSorter, params); The

Match all children width to widest child width in ConstraintLayout with width = wrap content

夙愿已清 提交于 2020-01-15 04:06:48
问题 ConstraintLayout is powerful but tricky sometimes. I want to implement a layout with the ConstraintLayout which can be easily achieved with the LinearLayout . The Blue area is parent constraintLayout. The red part is LinearLayout. I want to convert this LinearLayout to ConstraintLayout by maintaining the following conditions All children (Buttons)'s width should match the widest child. The widest child is not fixed. It will be changed at runtime. The red box should remain to maintain wrap

What is the difference between LinearLayout and FitWindowsLinearLayout?

老子叫甜甜 提交于 2020-01-15 03:43:10
问题 While creating a Layout, I cam across FitWindowsLinearLayout but can't seem to understand the difference between LinearLayout and FitWindowsLinearLayout . So, when should we use FitWindowsLinearLayout ? FitWindowsLinearLayout 回答1: First, as you can see it is annotated with @hide, which means, that it is not exposed to public API. That means that you should not use it. Secondly, to answer your question: as you can see from the implementation, it has one public method, which sets a listener:

layoutParams not changing

点点圈 提交于 2020-01-15 03:42:07
问题 I am trying to animate a horizontal list item dismiss the alpha animation works and the layoutparam values also decrease over time but for some reason that doesn't change the actual height of the list item. @Override protected void applyTransformation(float interpolatedTime, Transformation t) { final int initialHeight = view.getMeasuredHeight(); if(interpolatedTime == 1){ imageAdapter.remove(view, position); }else{ view.getLayoutParams().height = initialHeight - (int)(initialHeight *

Child Views that are translated, scaled or rotated disappear

徘徊边缘 提交于 2020-01-15 03:36:27
问题 I have a ViewGroup and I'm adding child Views to it like this: mViewGroup.addView(view, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); (the WRAP_CONTENT is important for the onclicklistener to work as expected). So far so good, but later I move the child Views around dynamically by either overriding their onDraw methods or by overriding the ViewGroups: protected boolean getChildStaticTransformation(View child, Transformation t) The problem is that the Children

Child Views that are translated, scaled or rotated disappear

∥☆過路亽.° 提交于 2020-01-15 03:36:09
问题 I have a ViewGroup and I'm adding child Views to it like this: mViewGroup.addView(view, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); (the WRAP_CONTENT is important for the onclicklistener to work as expected). So far so good, but later I move the child Views around dynamically by either overriding their onDraw methods or by overriding the ViewGroups: protected boolean getChildStaticTransformation(View child, Transformation t) The problem is that the Children

Android MasterDetail layout inside ActivityTab avoiding nested Fragments

纵然是瞬间 提交于 2020-01-15 03:11:49
问题 I'm not very expert in android's Fragment. In my last project i was using TabActivity, but because of it's deprecation now I'm starting implements an ActionBar using Fragments. Here is the code of my Tab Class: public class TabInterventoClass extends FragmentActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar

Android MasterDetail layout inside ActivityTab avoiding nested Fragments

99封情书 提交于 2020-01-15 03:11:06
问题 I'm not very expert in android's Fragment. In my last project i was using TabActivity, but because of it's deprecation now I'm starting implements an ActionBar using Fragments. Here is the code of my Tab Class: public class TabInterventoClass extends FragmentActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar

Pass model object to another Activity

时光总嘲笑我的痴心妄想 提交于 2020-01-14 14:17:07
问题 I have a RecyclerView that utilizes a Recycler Adapter to output a list layout, like this: http://i.imgur.com/ORkXXTb.png I need to attach the model below to each of the list items, such that if the user clicks on any element in the list item (like the circle or one of the two TextViews), it passes the model object to the next Activity . Here is the User model: public class User { private String id; private String username; private String displayName; private Object deletedAt; private