Android Studio Preview Window - Render ListView Item Template - android-listview

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

Related

How to change splash screen in dark mode(Android)?

I created a simple project and added the flutter_native_splash package. I am running this project on my android phone via USB. If my phone is in light mode splash screen works fine. But in the dark mode, it did not work. So then I tried to add my splash screen image to android/app/src/main/res/drawable-night and it worked. The problem is when I tried to build apk it gives me an error. If I remove what I added to android/app/src/main/res/drawable-night I can build apk successfully
In your project folder's android/app/src/main/res there should be a drawable folder, which contains the launch_background.xml for light theme. Duplicate this folder and call the second one drawable-night and configure the dark theme style. It will automatically change based on Android's system theme.
The launch_background.xml in the drawable (light theme) folder can be structured as so, to display an image with a white background:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/white" />
<item>
<bitmap
android:gravity="center"
android:src="#drawable/launch_image" />
</item>
</layer-list>
Here are some sources,Here and
Source

Space key not working in input control when added inside sap.m.ObjectHeader

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.

How can i solve the problem of missing constraints in constraint layout

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.

Review UI Widget from Google Play

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/

How to set a whole Page to responsive Design with gwt-bootstrap?

I'm building a web application for Tablet. I code the css first myself. Now i added some widgets which use gwt-bootstrap. Well now i saw that gwt-bootstrap has some Methods like : setHideOn(Device.PHONE)
I'm trying now to added such a method to my whole app to make it responsive. How should i process?
Adding this to your *.gwt.xml file:
<set-property name="bootstrap.responsiveDesign" value="true"/>
Will enable responsive design.
The setHideOn(Device.PHONE) that you said is for hide/show specific widgets in specific cases.