viewgroup

How to use Scroller in ViewGroup (android)

不打扰是莪最后的温柔 提交于 2020-01-02 09:57:43
问题 I have a custom ViewGroup and would like to add scrolling ability to it. Is it possible to use a Scroller object and link it up with view group? I have read somewhere that Scroller does not do any actual scrolling. That means it must be delegating the scrolling responsibility back to ViewGroup. thanks 回答1: The ScrollView object is what allows for scrolling. Basically, most Views are able to be scrolled, but they have no way of propagating touch events to the View class. A ScrollView handles

ConstraintLayout with Barriers; How to constraint to bottom / top of barrier depending on size

时光怂恿深爱的人放手 提交于 2019-12-30 05:14:12
问题 I am trying out the new Barrier feature in the 1.1.0-beta1. It works as expected however there is this use-case I cant seem to figure or (or is possible ConstraintLayout at all?) What I am trying to accomplish is: I have a imageview to the left, and title and subtitle textviews to the right of the imageview. Imageview is fixed height. I have a button, that is bottom constrained to the bottom of the imageview however should be top constrained to the bottom of the subtitle textview, if

Views inside a custom ViewGroup not rendering after a size change

时光怂恿深爱的人放手 提交于 2019-12-30 00:28:28
问题 I'm running into a problem that has me stumped and I was hoping someone could give me some pointers. I'm working on an application that uses a custom ViewGroup (actually a FrameLayout that contains a RelativeLayout) to render an event calendar. The events inside the calendar are represented as views that are sized according to the duration of the event and the size of the containing view. I'm running into a problem that occurs when the containing FrameLayout is resized. The current

Android View resize and WindowManager: unwanted transition during child view placement

夙愿已清 提交于 2019-12-25 18:14:39
问题 I'm having some problems in avoiding an unwanted transition during child view placement in a custom ViewGroup after parent view resizing. This problem seems to be only present when using the WindowManager instead of the call to setContentView() . Here is a short example: MainActivity : public class MainActivity extends AppCompatActivity { private static final int MY_PERMISSIONS_DRAW_OVER_OTHER_APPS = 1; CustomViewGroup mCustomViewGroup; WindowManager mWindowManager; @Override protected void

How Do I Set My View LayoutParams Width Smaller?

拜拜、爱过 提交于 2019-12-24 06:47:46
问题 Hi I am borrowing Seth's method found here to animate my viewGroups. It works great but in the wrong direction - This is my first time using/extending the Animation class and I cant figure how to decrease the size of my view -This expands it. Below is the class and how I use it. Any help will be greatly appreciated. public class ContainerAnim extends Animation { int targetWidth; View view; boolean opened; public ContainerAnim(View v, int targetWidth, boolean opened) { this.view = v; this

Implement Drag & Drop in Gingerbread

时光怂恿深爱的人放手 提交于 2019-12-23 08:58:49
问题 I need to know how I can implement Drag & Drop in Android for the Gingerbread version. As I know Gingerbread doesn't support that by default. What I have coded: a ViewGroup class to hold dynamic added child, each child should after a long click be able to get moved through a finger tap/move. To solve this, i have a OnLongClickListener attached to each View 's child and my ViewGroup have implemented both the methods onTouch() to get the down/up/move events and the method onLongClick() to

Android View and ViewGroup

别等时光非礼了梦想. 提交于 2019-12-23 07:38:40
问题 In Android ViewGroup inherits from View . A ViewGroup is a container which holds Views . ViewGroup (LinearLayout) View (TextView) Why did folks at Android defined this relationship as Inheritance instead of composition. As the ViewGroup contains Views shouldn't it be composition ? 回答1: I think you're getting too hung up on the wording. A "ViewGroup" has every bit as much reason to inherit from a "View" as a "TextView", and "ImageView" or ... more to the point ... a "ScrollView" or a

Scroll/Panning or drag in custom layout

我与影子孤独终老i 提交于 2019-12-23 05:11:31
问题 I have made custom Relative Layout for Zooming with lot of research since I am new to Android and now I want to incorporate the panning/dragging which should behave like Imageview, that is, bound limits. I am not using a matrix but the ScaleGestureDetector.SimpleOnScaleGestureListener . Now I want to incorporate the panning/dragging in the same. How do I achieve drag/panning in my code? Here is my custom relative layout with proper commenting and understanding. /* ////////////////////////////

Android - do ViewGroup onDraw need to iterate through child view and call onDraw explicitly?

核能气质少年 提交于 2019-12-22 17:53:51
问题 I have spent the whole day debugging various ways to add custom ViewGroup into another custom ViewGroup and nearly went crazy because none of them works, and there is no official documentation or sample that shows how it can be done... Basically, I have 2 custom ViewGroup : HorizontalDockView extends ViewGroup GameEntryView extends FrameLayout HorizontalDockView overrides onDraw , onMeasure , etc and everything is called normally and works perfectly. However, when I create GameEntryView from

Android StackOverflowError in ViewGroup.resetResolvedTextDirection

允我心安 提交于 2019-12-22 05:01:04
问题 I just went to android market to publish an update to my app and noticed there a few new errors reported from existing installs. While I can understand (and attempt to do something about) most of them, this one leaves me rather puzzled: java.lang.StackOverflowError at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at android.view.ViewGroup.resetResolvedTextDirection(ViewGroup.java:5131) at