I get following output from lint during my application's build
This TableRow layout or its TableLayout parent is useless [UselessParent]
This TableRow layout or its TableLayout parent is useless [UselessParent]
This TableLayout layout or its LinearLayout parent is useless [UselessParent]
This RelativeLayout layout or its LinearLayout parent is useless; transfer the background attribute to the other view [UselessParent]
How can I make it navigate me to the respective file by double clicking it, like in Error List? Or at least show me the file with line number?
Related
I have a Vaadin 8 application with several views.
public class ViewName extends Panel implements View {
There is a VerticalLayout as main layout in the panel.
public ViewName() {
setSizeFull();
VerticalLayout mainLayout = new VerticalLayout();
setContent(mainLayout);
Then I have many different layouts (HorizontalLayout, GridLayout) or Components such as Label being added as components to the mainLayout. For the HorizontalLayouts I often do the following to use the full width of the screen:
hLayout.setWidth("100%");
I have a lot of icons, grids etc. Everything is OK as long as I don't resize the window.
When I resize the window to a small size I get a mess (icons, text etc. on top of each other) and no horizontal scrollbar. (However, the grids get horizontal scrollbars.) I have tried many things to fix this. If I add
mainLayout.setSizeFull();
or
mainLayout.setWidth("100%");
I have a mess on the big screen already. I also tried the CSS for the mainLayout as described here. I get several scrollbars but none for the window itself!
The only component that resizes correctly is a Label added to the mainLayout, e.g.:
Label title = new Label("Some text",ContentMode.HTML);
title.setWidth(100, Unit.PERCENTAGE);
mainLayout.addComponent(title);
mainLayout.setComponentAlignment(title, Alignment.MIDDLE_CENTER);
I also noticed that anything in a GridLayout seems to stay in place after resizing but is not vissible since I have no scrollbar. However, icons in a HorizontalLayout get on top of each other.
What is wrong? Please, I need a general instruction on which layout I should use as main layout for my view panel, how to size the components and how to get ONE horizontal scrollbar for the main window if necessary.
The problem is that you are setting the width of your mainLayout to the width of your view. This means, that your mainLayouts width will never be bigger than your views width. So no scroll bar will appear.
According to the information you posted, changing your mainLayouts width to undefined should fix the problem.
mainLayout.setWidth("-1px");
How can i overlap two components in a horizontal layout. I have a progress bar in which i am trying to add a label upon it. The problem is i have structured my layout as horizontal layout upon a vertical layout. I have added components into the horizontal layout. As per my below code how can i add a two label upon a progress bar component, _process. This whole layout is build through Vaadin 7.6.3, Groovy programming.
The main layout is:
_VLayout = new VerticalLayout();
_VLayout.setSizeFull();
_VLayout.setSpacing(true);
_VLayout.addStyleName("new");
setCompositionRoot(_vLayout);
The layout added into vertical layout is horizontal layout which is _Layout.
_Layout = new HorizontalLayout();
_Layout.setSpacing(true);
_Layout.setSizeFull();
_Layout.addComponents(_machineName, _process, _Label, _time);
_Layout.setExpandRatio(_machineName, 0.1f);
_Layout.setExpandRatio(_process, 0.4f);
_Layout.setExpandRatio(_Label, 0.2f);
_Layout.setExpandRatio(_time, 0.3f);
I wanted to add a label on a _process, which is a progress bar. But how can i do that. ?any suggestions would be helpful.
I have a BottomSheetDialogFragment which is opened from another fragment.
bottom_sheet_fragment.xml:
<LinearLayout>
<TabLayout/>
<ViewPager>
</LinearLayout>
I have two fragments for the view pager each of which contains an EditText and a RecyclerView in vertical fashion.
view_pager_fragment1.xml:
<LinearLayout>
<EditText/>
<RecyclerView>
</LinearLayout>
Now when ever I click on the edit text a part of recycler view is getting hidden behind the key board.
Expected:
When ever keyboard appears the bottomsheet should scroll up so that the recycler view contents remain visible.
I've managed to achieve the behavior you want by making the root view of the BottomSheetFragment layout a android.support.v4.widget.NestedScrollView. Don't know if its going to work for you, as you seem to be using other scroll views inside.
I have a view controller laid out in a storyboard using size classes and autolayout. I've added a couple pages of text inside the text view. When I present the controller containing this text view using form sheet style on iPad, the text within the textview is scrolled down, cutting out first 4-5 lines.
How can I make sure that UITextView rearranges it's contents so first line of text is displayed at the top (where it is expected to be)?
Here's what I see in storyboard. When presented, the word "test" is hidden off the top of the textview (where the word play is).
It's a bug with size classes, but here is a workaround:
If your scene in storyboard is bigger than on the device (simulated metrics "freeform"), the auto layout will size down the view and changes the scrolling of the text view.
If you preview the scene with the smallest simulated metrics (iPhone 3.5-inch landscape!), the text view will keep size or grow and the scrolling is ok.
I am working on an application that functions like a text messaging app. I am working on the layout of the app now. In the XML file I have an edit text on the top of the screen and one on the bottom of the screen. I want to dynamically create a scrollview that would be between the 2 edit texts. The scroll view would enable to scroll through multiple messages of the app. When I try to create the scrollview and textview dynamically it replaces the edittexts and they disappear.
So my question is how would I go about preventing the edittexts from disappearing and adding a scrollview in between the 2 edit texts ?
My code is like this:
ScrollView sv = new ScrollView(this);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
sv.addview(ll);
TextView tv = new TextView(this);
tv.setText("Dynamic layouts ftw!");
ll.addView(tv);
this.setContentView(sv);
What you are asking to do is build a ListView. ListView'ss have every function you require and more. Further, with the adapters, they are pretty quick. Here is a decent turorial on using ListViews.