How to move imageview in B4A - vb4android

How to move ImageView (added in the designer) in B4A, I google it but I can't find how to move it. imageview1.left = 100 does not works (I use main for scripting)

Related

What is the difference between MotionLayout and Animation in Android & which one should we use?

MotionLayout Extends ConstraintLayout and have all its feature while we can move a widget on click in Motionlaout scene and we can also move a widget via our old Animation. I just want to ask which one is better and which one to use and what is the difference.

webview.findnext() start highlighting from the current position of touch in the screen

I'm new in android studio. I'm working on a simple project. It uses a webview which loads the html page. I also use an action bar for searching, refreshing , ... in the page bellow:
By pressing the search button, findAllAsync() method is used to find and highlight all the matches in the page (matches are shown in yellow color). The next button in the action bar uses the findnext(true) method and allows user to move between the highlighted matches. Using this method, the next one is highlighted in red color:
next.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
st = et.getText().toString();
if(!st.equals("")&& st!=null) {
ourBrow.findNext(true);
}//not null
}//on click
});// next Button click
If I only scroll or zoom in the webview everything is ok and the find next is continued from the previous one in the page. However if i touch somewhere in the webview and then click the next button, the red highlighting is not continued from the previous position in the page. For example if the previous red highlighted is at the first of the page and i touch the end of the page and when i click the next button, the middle yellow matches are escaped and the last one which is in end of the page is highlighted in red color and red highlighting is continued from this position.
Since i need the user can continue search from the previous position and touching the screen does not affect this order, i searched a lot. I tried to disable touch event of the webview but keeping zoom and scroll ability based on the Android disable WebView touch but keep zooming/scrolling. But my problem is still unsolved. Please kindly help me to solve this problem.
thanks.
Edit:
To solve this problem i tried to clear focus of the view(How to remove focus without setting focus to another control?). But it doesn't work:
View current = getCurrentFocus();
if (current != null) current.clearFocus();
ourBrow.findNext(true);
I would recommend the following not the best approach (and it depend on your web page) but it will work, render the content of your web page to html using :
webview.loadData(URLEncoder.encode(result).replaceAll("\\+", " "), "text/html", Encoding.UTF_8.toString());
Than do whatever you want with your text highlight the way you want and then render it back to web page like this:
myTextView.setText(Html.fromHtml("Your HTML Page"));
API after nugget:
myTextView.setText(Html.fromHtml("Your HTML Page", Html.FROM_HTML_MODE_COMPACT));
Hope it helps

Why Eclipse's own tab is very large on Linux but SWT tab folders is not

Actually I am noticing that, the Tabs of Eclipse is too large on my Linux box.
So I've created simple app based on the code from http://www.mkyong.com/swt/swt-tabfolder-example/ but the tabs is very neat actually!
I am not a SWT guy, so I need to know what SWT components does Eclipse uses in its Tabs? and if they are the same in the example in the link, why it appears so big and ugly?
The following screenshot shows the Eclipse tab vs the Tabs of the TabFolder (from previous link)
The Eclipse folders are just done with CTabFolder. In Eclipse Kepler a custom renderer is used to support some of the CSS styling.
The curved edge is shown because CTabFolder.setSimple(false) has been called.
The area with the icons in it is not part of the tab, it is the view toolbar. It has been placed below the tab because the view is not wide enough to put the icons on the same line. If you increase the width of the view the icons will move to the same line:
Update:
Some of the spacing is due to the custom tab renderer org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering which uses the following fixed margins:
static final int ITEM_TOP_MARGIN = 2;
static final int ITEM_BOTTOM_MARGIN = 6;
static final int ITEM_LEFT_MARGIN = 4;
static final int ITEM_RIGHT_MARGIN = 4;

Slide UIWebView over a ImageView (like safari)

I think the title says everything about my problem.
The ImageView is not in the UIWebView.
I want that the ImageView is pushed up by the WebView.
It's actually pretty simple. If you go into your storyboard (or nib) and choose the the webView and choose a color for it's background property, anytime you scroll above the view that background color would appear. So all you need to do is load an image for that background color.
In your viewDidLoad method, place this bit of code:
self.webView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"background.png"]];
and where it says background.png
just put the image name that you loaded into your project.
Hope this helps!

Android: Dynamically adding textviews to a scrollview

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.

Resources