how to create button like this.I am new in android.I am trying to create this from last 3 days.
You can create XML using designer in Android Studio or
Go to res/layout/activity_main then XML file will be open then add
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"/>
Related
I'm using the here android SDK and started with the BasicMapSolution tutorial.
Now I want to add buttons on top of the map (zoom in/zoom out/center view to my position).
Unfortunately I did not figure out how to do it.
I tried adding a button in activity_main.xml like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- Map Fragment embedded with the map object -->
<fragment
android:id="#+id/mapfragment"
class="com.here.android.mpa.mapping.AndroidXMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="#layout/activity_main">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|top"
android:text="Demo Button"
android:padding="10dp"
android:layout_marginTop="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"/>
</fragment>
</LinearLayout>
But the button is not shown in the app. Can anyone help please. Just to make it clear, I want to achieve something like this:
Are you not able to do a zoom using 2 finger tap ? https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/map-gestures.html
Map gesture customisation can also be done. In case adding zoom controls is requirement then you can add a map marker object of unknown type, and pass zoom in min max range on its listener in premium SDK. As of now, traditional zoom in/zoom button add on controls are not available. you can refer below API documentation to check for mapobject and zoom range in details.
https://developer.here.com/documentation/android-premium/3.15/api_reference_java/index.html
Also refer to our github example for map marker objects and gestures that are already available >
https://github.com/heremaps/here-android-sdk-examples/blob/master/map-objects/app/src/main/java/com/here/android/example/map/objects/MapFragmentView.java
I'm using Android-WScratchView to implement a scratch effect in my app.
What my app does is a "cleaning" effect. I have a picture of a clean t-shirt and another picture of the same t-shirt but dirty (with some mud).
Android-WScratchView works great for the normal case, a background Image (clean t-shirt) and an overlay Image (dirty t-shirt).
The problem is now, I need to add a second overlay Image, which is a "less" dirty t-shirt so the user has to "clean" the t-shirt in 2 steps.
Once the first layer has been erased, I need to be able to erase the second layer but only where it is visible.
I've implemented it using 2 WScratchView objects, one behind another, like this:
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/shirt_clean" />
<com.winsontan520.WScratchView
xmlns:wsv="http://schemas.android.com/apk/res-auto"
android:id="#+id/scratch_view_layer_1"
android:layout_width="300dp"
android:layout_height="300dp"
wsv:antiAlias="true"
wsv:revealSize="20dp"
wsv:scratchDrawable="#drawable/shirt_less_dirty"
wsv:scratchable="true" />
<com.winsontan520.WScratchView
xmlns:wsv="http://schemas.android.com/apk/res-auto"
android:id="#+id/scratch_view_layer_2"
android:layout_width="300dp"
android:layout_height="300dp"
wsv:antiAlias="true"
wsv:revealSize="20dp"
wsv:scratchDrawable="#drawable/shirt_dirty"
wsv:scratchable="true" />
The problem is that after the "most dirty" layer is "erased" (it gets transparent) I cannot delete the "less dirty" layer because the second layer is getting the onTouch event.
My idea is parsing somehow the onTouch event through the second WScratchView to the first one. But still would have the problem that I don't know which area has already been deleted and which not.
I would appreciate any help, also a different way to implement it will be accepted.
Im new to Maximo. I already have maximo anywhere work execution app. Please let me know how to add new button in it through worklight.
Open the index.html file and add a <button> element.
If this does not help you, please learn how to ask questions first.
You can Edit the app.xml in <: Install Root :>/apps/<: app :>/antifact, like IBM MAXIMO Anywhere guide.
link: https://www.ibm.com/developerworks/community/blogs/a9ba1efe-b731-4317-9724-a181d6155e3a/entry/Adding_Custom_Fields_to_a_Maximo_Anywhere_application?lang=en
Before you embark on that Journey, be sure to back up the default app.xml. In order to add a button you first need to modify the Application UI, changes are made in the app.xml file .\MaximoAnywhere\apps\WorkExecution\artifact\app.xml. You can add additional tags to the file, which builds the UI and makes the app.
<button border="false" cssClass="statusIcon" id="WorkExecution.WorkDetailView_status_button_1" layoutInsertAt="item3" resourceAttribute="returnActive">
<states id="WorkExecution.WorkDetailView_status_buttons_return">
<state id="WorkExecution.WorkOrderDetail_ReturnButton_render_active" image="/images/RETURNED.png" label="Return" value="true"/>
<state default="true" id="WorkExecution.WorkOrderDetail_ReturnButton_render_inactive" image="/images/RETURNED_INACTIVE.png" label="Return" value="false"/>
</states>
<eventHandlers id="WorkExecution.WorkDetailView_status_button_eventHandlers_1">
<eventHandler class="application.handlers.Custom.WODetailHandler" event="render" id="WorkExecution.WorkOrderDetail_ReturnButton_render" method="renderReturnedIcon"/>
<eventHandler class="application.handlers.Custom.WODetailHandler" event="click" id="WorkExecution.WorkDetailView_status_button_1_eventHandlers" method="onReturnStatusIconClicked"/>
</eventHandlers>
</button>
Thats an example of a button we use in the app on the Work Details screen. Notice it has a CSS class that we've added, as well as a resourceAttribute that manages the state of the button. Putting a state on the button tells the app when to render which of the images. Lastly, we have event handlers that are tied to the button, with corresponding code written in the Custom.WODetailHandler file.
I have the the following Activity LinearLayout.
<!-- Main LinearLayout -->
<LinearLayout
...
android:orientation="vertical"
tools:context=".MainActivity">
<!-- Inner LinearLayout -->
<LinearLayout... />
<!-- Fragment holding Google Map Fragment -->
<fragment android:name=".MainMapFragment"
android:id="#+id/map_fragment"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="match_parent" />
<!-- Inner LinearLayout -->
<LinearLayout... />
</LinearLayout/>
I have some Google Map Markers displayed in the MainMapFragment showing that around that location there are some specific related business to look into.
Once a User clicks on any of those Markers on the Map... I need to display a LIST of all those Business associated to that MARKER and allow the User to Tag/Mark the business as FAVORITE or NOT.
I have everything done in relation to the Google Map, Markers, InfoWindow, etc... however... I would like to know what should be a good way/design/layout to DISPLAY the Business List (ListView is ok) detail information and allow the User to MARK AS FAVORITE any of the business in the list using a REGULAR BUTTON (or TOGGLE BUTTON) display within the Business Information Details.
Although I already thought on some choices (see below), I am not sure which one to go for it.
Launch a new Activity, once back (new activity finished) update the information within the Map, Markers, etc.
Add a new Fragment to the current Layout and SWITCH (hide/show) between the one with the Map and the one with the Business Information.
A Modal Dialog (DialogInterface, AlertDialog, etc)
Once again I am not sure where to go and so my question... what will be a good design/model to approach this request?
Sorry for my english, i think that you should use an activity, If I understood correctly on click event you should display details of the related place, a good habit of mobile programming is to display details in other activity with the back button in the action bar.
I ended up extending DialogFragment, not only works OK but also allowed me to work with anything in a custom/complex layout inside the Dialog.
In my main Activity I have created a bar with buttons on it. Now , I would like the "Button Bar" to always show regardless of what Activity I'm showing. Basically I need the handle the Button events from the "Button Bar" across all Activities. Is this possible, and what best practice to achieve this?
Use includes inside a Merge. The includes can be re used inside any view.
<com.testmerge.TitleBar
id="#+id/titlebar"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:layout_gravity="top"
android:paddingTop="0dip"
android:background="#drawable/title_bar"
/>
<com.testmerge.OkCancelBar
android:layout_width="fill_parent"
android:layout_height="60dip"
android:layout_gravity="bottom"
android:paddingTop="0dip"
android:background="#drawable/header_bkgrnd"
/>
<!--"#AA000000"-->