Questions tagged [android-viewgroup]

A ViewGroup is a special view that can contain other views, called children. The view group is the base class for layouts and views containers

223 questions
0
votes
2 answers

What is causing the item(View) in the Container (ViewGroup) class to move quickly and randomly after it has been rotated 90 degrees?

Description: I have a class called Container which can hold items. In the code below I added only one item to the container. The user can move this item by dragging it and rotating it by 90 degrees by double-clicking on it. Before double-clicking on…
Abdo21
  • 498
  • 4
  • 14
0
votes
2 answers

How to get bitmap from ViewGroup?

I'm using recycler view where each item is simple ImageView. My RecyclerView is places in a ViewGroup - FrameLayout. My task is to get from my FrameLayout - a bitmap. That is, I need to get a bitmap that will contain pictures that are visible on the…
0
votes
0 answers

How to add custom views in custom group view and be able to move them in android

I want to create a custom view that will act as a container for other custom views. The user will be able to move the view you want to move by dragging it. For the container, I implement it by extending ViewGroup: public class MyContainer extends…
0
votes
0 answers

Outer ViewGroup attributes to be applied by all children of nested ViewGroup

I need to create custom viewgroup that contains children which are proceeded with the attributes of the outer viewgroup for my custom. For example,
0
votes
1 answer

Get attrs value in customview kotlin class when format="reference"

I have created one CustomView class where I want to get drawable dynamically. So for that have created attrs.xml
Maradiya Krupa
  • 213
  • 1
  • 6
0
votes
1 answer

What exactly is container parameter in onCreateView method in Fragment

When I want to create a simple fragment, usually use following code: public class TestFragment extends Fragment { @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle…
0
votes
2 answers

What will be the difference between adding the view programmatically vs using recyclerView?

There is a canvas and As a beginner, I have learned about viewGroup in android and how to add a view or multiple views in a viewGroup using either xml or programmatically using addView. We can add as many view we want to add and we can also increase…
0
votes
0 answers

Why are the third and fourth parameters of child.layout() prefixed?

child.layout(x, y, x + child.getMeasuredWidth(), y + child.getMeasuredHeight()); As you can see from the code snippet above, the third parameter is prefixed with x and the fourth with y. Aren't x and y co-ordinates? What's the difference if I do…
Tendai
  • 71
  • 6
0
votes
1 answer

TabLayout & ViewGroup : The specified child already has a parent. You must call removeView() on the child's parent first

I have a tabLayout setup iwth viewpager on my MainActivity: tabLayout.setupWithViewPager(viewPager); The initial fragment loads without any issues. However, when clicking on one of the tab titles I get the following error: "The specified child…
Miguel Tomás
  • 1,714
  • 1
  • 13
  • 23
0
votes
0 answers

ConstraintLayout - onMeasure() for ViewGroup

I've created custom View which extends ConstraintLayout. I want to implement onMeasure() because I've notices issues with size customization on different components with different sizes and/or paddings/margins. This is my View's layout:
SkypeDogg
  • 1,000
  • 2
  • 13
  • 28
0
votes
1 answer

How can I convert ViewGroup into white background Bitmap?

view.measure(MeasureSpec.makeMeasureSpec(view.layoutParams.width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(view.layoutParams.height, MeasureSpec.EXACTLY)) view.layout(0, 0, view.measuredWidth,…
0
votes
1 answer

Draw multiple images at specific coordinates using Canvas and Bitmap

I am new to Android Development, I was learning canvas and bitmap and I wanted to draw a 5 pictures on 5 different coordinates on the screen. These coordinates are given by user and images are generated when a button is pressed. I was going through…
0
votes
1 answer

Why we can not add direct multiple views in scrollview?

I am new to Android Development and learning ViewGroups. So, I found it very strange that why we can't add more than one direct view or viewGroups in scrollview?
Shoaib Kakal
  • 1,090
  • 2
  • 16
  • 32
0
votes
1 answer

SubClass of FrameLayout Class doesn't redraw canvas screens?

When I am using FrameLayout Class(GameView) to use addView(object) so that I can use ontouchlistener() but it only draws Rocket and shooter (classes used to draw , all are called in GameView ) but it didn't reDraws it (refer summary at…