The view is not constrained. It only has design time positions, so it will jump to (0,0) at runtime
The attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor.
You need to give your view both vertical and horizontal constraints so in the run time he will have its position relative to the screen. If you won't do it your view will have no vertical/horizontal place to be and will jump from its location to the start if the screen.
You can do it like this for example:
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
Also, you can check the official documentation for more information.
Related
My app has a search bar in its top area. There are devices with special cutouts. in order to expand the app to real full screen, I Added to <app_name>\android\app\src\main\AndroidManifest.xml:
<style name="ActivityTheme">
<item name="android:windowLayoutInDisplayCutoutMode">
shortEdges
</item>
</style>
That works fine. However, the obvious next step is to recognize cutout position, and place the search bar accordingly:
The mentioned documentation refers to a JAVA method WindowInsets.getDisplayCutout(). I wonder if there is an equivalent in flutter or a plugin which wraps it.
There is a SafeArea widget that will add insets so that you can avoid device. I'd give this a try - I know it works with common features like the iphone top cutout and the android camera.
I have a problem with space key (Space bar) on the keyboard, which doesn't work when I try to type text in FeedInput on Fiori Application. It is possible to add empty space in case I press Shift + Space. This combination works on PC, but not on mobile devices.
I know that the problem happens because I'm embedding the FeedInput inside <headerContainer> or some of the other UI elements. It's actually not relevant only for FeedInput, but also for Input, SmartField in SmartTable, etc.
I can see that SAP provides the following info for class sap.m.HeaderContainer:
The container that provides a horizontal layout. It provides a horizontal scrolling on the mobile devices. On the desktop, it provides scroll left and scroll right buttons. This control supports keyboard navigation. You can use ← and → to navigate through the inner content. The Home key puts focus on the first control and the End key puts focus on the last control. Use Enter or Space key to choose the control. (source)
I found that if I delete event listener in browser debugger for KEYPRESS body#content.sapUiBody, the space bar starts working fine for all type of text fields.
<ObjectHeader id="ohDetails"
numberState="Success"
responsive="true"
>
<headerContainer>
<IconTabBar id="itb1"
select=".onIconTabBarSelect"
expandable="false"
>
<items>
<!-- ... -->
<IconTabFilter id="iftLog"
key="logKey"
icon="sap-icon://notes"
>
<VBox alignContent="End">
<FeedInput id="fiComment"
class="sapUiSmallMarginTopBottom"
post=".onSubmitComment"
icon="sap-icon://comment"
placeholder="{i18n>plhFeedInput}"
/>
<!-- ... -->
</VBox>
</IconTabFilter>
</items>
</IconTabBar>
</headerContainer>
</ObjectHeader>
There is nothing wrong with putting <IconTabBar> as the header container of <ObjectHeader>. In fact, the <headerContainer> aggregation awaits <IconTabBar> as one of the controls that implements "sap.m.ObjectHeaderContainer".
The reason why it didn't work was because of the regression introduced with commit:d05437d while trying to prevent scrolling when the space bar was pressed. With commit:38f5481, it's all fixed now.
Preventing all pressing of SPACE when inside ObjectHeader caused that, in case there is Input field inside HeaderContainer, the user couldn't enter space in it.
On the other hand, SPACE is still prevented on all interactive elements of the ObjectHeader.
Demo: https://jsbin.com/takequm/edit?js,output
Update: the fix is now distributed with 1.67+. After updating the UI5 resource bootstrap to, for example, src="https://ui5.sap.com/1.70.0/resources/sap-ui-core.js", we can see that the spacebar works again.
I have a home page where there are tiles which will redirect to a new splitapp page. Inside one of those generic tiles I have to show the entire splitapp view with some modifications. I know we can add multiple content inside a Tile content using vbox, but is it possible to add the entire splitapp? I tried it, but it displays nothing other than just increasing the height of the tile.
What i have tried is -
<TileContent>
<Vbox>
<SplitApp id="idAppControl"></SplitApp>
</Vbox>
</TileContent>
This just increases the height of the tile but displays nothing.
In Android Studio, while working in Text mode for a view i have the "Preview" window active to the right. When adding a listview to the view it renders a default list. I have a custom template which is used at runtime but is it possible to have the preview window show me my template at design time?
Thanks
Add the tools namespace to your xml layout:
xmlns:tools="http://schemas.android.com/tools"
next you can specify the listitem layout like this:
tools:listitem="#layout/mycustom_listitem"
Full example:
<ListView
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/lv_contactslist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:listitem="#layout/listitem_contact" />
For a graphical way, have a look at this stackoverflow post
I need to implement a Reviews widget in my application, similar to that seen in Google Play. Image Below:
Are there any components our there that make it easier to do this? It would save time & trouble of implementing my own version.
Thanks
I would create a custom layout for that.
A TextField for stars information, a progress bar to show the number of stars and another TextField to show the number of ratings. Everything rapped on a LinearLayout (orientation = horizontal) for proper alignment.
I used a custom layout for this as cmota recommended.
The labels for the stars are a series of TextViews within a Relative layout
The rating bars are Imageviews in a Linearlayouts.
Code snippet:
ImageView ratingOne = (ImageView) ratingsView.findViewById(R.id.ratingOne);
<LinearLayout
android:layout_width="match_parent"
android:layout_height="15dp"
android:background="#android:color/white"
>
<ImageView
android:id="#+id/ratings_length_one"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:background="#color/orange" />
</LinearLayout>
Each imageview has a fixed height : for example i use 15dp above
The width of the imageview is the my rating count
Then i change the layoutParams for each imageView according to the values
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(myRatingCount, ratingOne.getHeight());
ratingOne.setLayoutParams(layoutParams);
Implement RatingBar in android.
some sample links
http://www.mkyong.com/android/android-rating-bar-example/
http://www.learn-android-easily.com/2013/08/android-ratingbar-example.html
http://examples.javacodegeeks.com/android/core/ui/ratingbar/android-rating-bar-example/