Why Is There a "Plus" Icon at the Top Right Corner of My View

Why is there a plus icon at the top right corner of my view?

It is managed by DropProposal drop operation and by default (if you do not provide explicit drop delegate) is .copy as documented, which adds '+' sign. By this you inform user that something will be duplicated.

/// Tells the delegate that a validated drop moved inside the modified view.
///
/// Use this method to return a drop proposal containing the operation the
/// delegate intends to perform at the drop ``DropInfo/location``. The
/// default implementation of this method returns `nil`, which tells the
/// drop to use the last valid returned value or else
/// ``DropOperation/copy``.
public func dropUpdated(info: DropInfo) -> DropProposal?

if you want to manage it explicitly then provide DropDelegate with implemented drop update as in below demo

func dropUpdated(info: DropInfo) -> DropProposal?
// By this you inform user that something will be just relocated
return DropProposal(operation: .move)
}

Position icon at the top right corner of a div

You can add an icon like your showing image, here is the solution

HTML:-

<div class="circletop">
<div class="numberpr">3° anno</div>
<div class="lordo">Valore lordo stimato</div>
<!--I add div icon here-->
<div class="icon">my icon</div>
<div class="valori"> € 65.000 - € 67.000</div>
</div>

CSS:-

.circletop {
/* circle styles */
width: 300px;
height: 300px;
font-family: Raleway;
border: 1px solid #222;
border-radius: 50%;
margin: 0 auto;
box-shadow: 0 0 20px #ccc;

/* become a flex container */
/* its children will be flex items */
display: flex;
/* place items in column */
flex-direction: column;
/* center flex items horizontally */
align-items: center;
/* center all content vertically */
justify-content: center;
}

/* simulate one more item to "balance" dex text */
.circletop:before {
content: "\A0";
visibility: hidden;
}

.lordo {
color: #45cec8;
padding-top: 10px;
padding-bottom: 25px;
font-weight: bold;
font-size: 19px;
}

.valori {
border-radius: 50px;
background: #05c6bf;
padding: 14px;
width: 100%;
color: #fff;
text-align: center;
box-shadow: 0 0 9px #45cec8;
font-size: 25px;
font-weight: bold;
}
.icon {
position: relative;
bottom: -19px;
right: -162px;
}

Trying to format an image in the top right corner – SwiftUI

Edit: Because your image is in a ZStack, it will expand and overflow the screen. You should use the background modifier instead.

struct ContentView: View {
var body: some View {
VStack{
HStack {
Spacer()

Button(action: {}, label: {
Image(systemName: "gear").resizable().aspectRatio(contentMode: .fit)
.frame(width: 50, height: 50) })
}
.padding()

Spacer()

HStack {
Button(action: {}, label: {
Image(systemName: "plus")
.resizable().aspectRatio(contentMode: .fit).frame(width: 150, height: 150, alignment: .center).padding().border(Color.white, width: 8).cornerRadius(10.0).foregroundColor(.white)
})
}
Spacer()
}

/// here!
.background(
Image("Background")
.resizable()
.aspectRatio(contentMode: .fill)
.ignoresSafeArea()
)
}
}

Result:

Image of gradient in background, plus icon centered, settings icon at top-right

If you're using a ZStack to layer the background, a view inside there might be expanding beyond the edges. I've tried to reproduce what you want below, but it would be helpful if you posted some more code.

struct ContentView: View {
var body: some View {
ZStack {
LinearGradient(gradient: Gradient(colors: [.blue, .green]), startPoint: .top, endPoint: .bottom)
.ignoresSafeArea()

Image(systemName: "plus")
.resizable()
.foregroundColor(.white)
.frame(width: 200, height: 200)

VStack{
HStack {
Spacer()

Button(action: { }) {
Image(systemName: "gear")
.resizable()
.foregroundColor(.white)
.frame(width: 50, height: 50)

}
}

Spacer()
}
}
}
}

Result:

gradient background, plus icon centered, settings icon at top-right

How to position plus sign right in the middle of circle

use Image(systemName: "plus").foregroundColor(.white) instead of Text("+")

In text "+" symbol doesn't have to be in the middle of the view because of text layout.

SFSymbols are more convenient in this regard. Also you can specify size with .font(.system(size: 10))

Change position of icon right top corner of Google map which finds current location

Try this way,hope this will help you to solve your problem

View plusMinusButton = suppormanagerObj.getView().findViewById(1);
View locationButton = suppormanagerObj.getView().findViewById(2);

// and next place it, for exemple, on bottom right (as Google Maps app)
RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) locationButton.getLayoutParams();
// position on right bottom
rlp.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0);
rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);

Icon in top Corner using Bootstrap 4

Boostrap-4 does have .classes for a situation like this. So You need to write some custom CSS.

Use postion:relative on .badge elements and postion:absolute on icons.

.badge {

display: inline-block;

margin: auto 10px;

padding: 10px 30px !important;

}

.fas {

padding: .2rem .3rem;

position: absolute;

/* You may need to change top and right. They depend on padding/widht of .badge */

top: -10px;

right: -10px;

background: green;

border-radius: 50%;

}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" rel="stylesheet"/>

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>

<div class="tagset mt-5">

<span class="badge bg-primary position-relative">User <i class="fas fa-user"></i></span>

<span class="badge bg-primary position-relative">Add Me <i class="fas fa-plus"></i></span>

<span class="badge bg-primary position-relative">Loss Me <i class="fas fa-minus"></i></span>

</div>

How can I get a clickable icon on the top right corner of a button in flutter?

you can use the Stack and Positioned widget for that


ButtonTheme (
minWidth: 250.0,
height: 80.0,
buttonColor: Color.fromRGBO(234, 135, 137, 1.0),
child: Stack(
children: [
RaisedButton (
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
side: BorderSide(
color: Colors.transparent,
),
),
child: Text(
'Daily Challenge',
style: TextStyle(
color: Colors.white,
fontSize: 22.0,
fontFamily: 'MuseoSans',
),
),
onPressed: () {
//click actions
},
),
Positioned( // will be positioned in the top right of the container
top: 0,
right: 0,
child: Icon(
Icons.help,
),
)
]
)
),

How can I position an icon over an image?

You need a relative container around your image and then you set your icon to be position: absolute.

.container { position: relative; }

.container img { display: block; }

.container .fa-download { position: absolute; bottom:0; left:0; }
<link href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" rel="stylesheet"/>

<div class="container">

<img src="https://placekitten.com/300/300">

<a href="dog.png" download="new-filename"><i class="fas fa-download"></i></a>

</div>


Related Topics



Leave a reply



Submit