How to arrange two textviews(First textview should be at left side of screen& Second textview should be at center of screen) in android - android-relativelayout

I want to arrange the text views as per following way:
First text view should be left side of screen.
Second text view should be center of screen.
Currently i am using the relative layout and following is the code and sample image screen shot.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:id="#+id/header_layout">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text1"
android:id="#+id/back_navigation"
android:drawablePadding="10dp"
android:paddingRight="5dp"
style="#style/LargeTextSizeStyle.Bold.CeruleanColor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Text2"
style="#style/LargeTextSizeStyle.Bold.CeruleanColor"/>
Layout sample screen shot
The text views are arranged properly if they have small length of texts. But issue is two text views are overlapping to each other when they have big length of texts.
Can you please suggest me to solve the issue

You should change wrap_content to a fixed number,like :
<com.gui.home.ui.customviews.CustomTextView
android:layout_width="100dp"
android:layout_height="100dp"
android:text="Text1"
android:id="#+id/back_navigation"
android:drawablePadding="10dp"
android:paddingRight="5dp"
style="#style/LargeTextSizeStyle.Bold.CeruleanColor"/>

Related

Bring Label to the front in a Xamarin Grid

Im trying to have a Label on top of the Map but when I put them inside a Grid like this
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Red">
<Frame BackgroundColor="{StaticResource Color2}" Margin="0">
<Label TextColor="{StaticResource Color5}" FontSize="60" FontAttributes="Bold" x:Name="TituloNombre" HorizontalOptions="CenterAndExpand"></Label>
</Frame>
<local:CustomMap IsShowingUser="True" HasScrollEnabled="True" HasZoomEnabled="True" MapClicked="mapaXaml_MapClicked" x:Name="mapaXaml" Opacity="0.5"/>
</Grid>
The map covers the Label and the only way I can see it is by changing the opacity of the map.
Items within the Grid will be rendered back to front. Ie, things that are listed first will be behind things that are later in the same container
Reorder uour Grid so the Label is after the Map

How to get the navigation drawer below the action bar, not below of the tab bar

I am getting my navigation drawer below the tab bar but I want it to be below the title bar or action bar.
The second problem is when Navigation drawer is opened, even if we click on the tabs it is changing fragments. I want tabs click should be disable, when Navigation drawer is opened
Here is my main_layout.xml
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
<android.support.design.widget.TabLayout
android:id="#+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabMode="fixed" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="false"
android:textAlignment="center"
tools:openDrawer="start">
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:contextClickable="false"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
I have tried placing viewpager element above the drawerlayout even though I am getting same problem.
Here is my emulator output screenshot
Use drawer layout over action bar as usual but insert android:paddingTop="?attr/actionBarSize" line to drawerLayout tag... Or move tabLayout tag to below navigationView tag

SAPUI5 / CustomTile - slide by one tile

I'm developing an SAP-ui5 XML view. In that view I created dynamic custom tiles using the CustomTile tag, as demonstrated in this image:
<TileContainer
id="container"
height="400px"
tileDelete="handleTileDelete"
tiles="{/TileCollection}">
<tiles>
<CustomTile id="ct1">
<content>
<VBox>
<Toolbar class="backcolor" design="Transparent">
<Text class="sapMHeader" text="Dynamic content" />
</Toolbar>
<Button type="{infoState}" text="Button"
icon="sap-icon://approvals"
ariaDescribedBy="defaultButtonDescription genericButtonDescription">
</Button>
</VBox>
</content>
</CustomTile>
</tiles>
</TileContainer>
Currently, clicking on the navigate button slides three tiles per click. I want to get it to slide only one tile per click. How do I achieve this?
The TileContainer control is responsive meaning how many tiles you see totally depends on the available screen space and nothing else. The scroll-buttons act as an overflow and slide a complete 'page' just as a Carousel would do. There is no way of changing this behavior via existing API.
If you really want to adapt this behavior TileContainer.prototype.scrollLeft and TileContainer.prototype.scrollRight are probably a good starting point.
BR
Chris

Windows Phone 8 Continue parent scrolling

I have a Windows Phone 8 application (please note that it's not 8.1) and I have the following struggle.
I have a page containing a StackPanel. Within the StackPanel there are several objects like buttons, textboxes and a LongListSelector.
The LongListSelector is bound to an ItemsSource. Because it can contain a lot of items I had to set the MaxHeight (otherwise it exceeds the limit of 2000px of vertical screen space)
However when scrolling the page down I stumble upon the LongListSelector. I can than scroll the LongListSelector too, which is fine. But when I scroll to the end of the LongListSelector it won't 'snap' to the StackPanel so it just leaves the page there and doesn't continue with scrolling to StackPanel.
A short code example:
<StackPanel>
<Button />
<TextBlock />
<TextBox />
<Button />
<LongListSelector>
This contains a bunch of items
<LongListSelector/>
<TextBox />
</StackPanel>
So what happends is.. I can scroll the complete page to the LongListSelector. I can scroll the LongListSelector. But when I'm at the end of the LongListSelector.. It wont continu scrolling the page.
So I never see the last TextBox (in this example that is)
I've also tried replacing the LongListSelector with a ListBox but that doesn't make any difference.
Hope that someone can help me out here.
From your Question what I understood is that the total height by summing up your UI Elements is more than the Page Height. If you put a ScrollViewer Tag at the start and End of StackPanel. It will work just fine. In ListBox and LongListSelector it is implied.
<ScrollViewer>
<StackPanel>
<Button />
<TextBlock />
<TextBox />
<Button />
<LongListSelector>
This contains a bunch of items
<LongListSelector/>
<TextBox />
</StackPanel>
</ScrollViewer>

header text going on two lines

I have a gridview in which one of my column's header text is going on two lines, which look very ugly,
I added item width and header width but no good,
<asp:BoundField DataField="userID" ReadOnly="true" HeaderText="User ID But Only ID" HeaderStyle-Width="300px"
ItemStyle-Width="300px" />
Anyone guide me to right direction as I want User ID But Only ID in 1 line in header