如果我有这样的约束布局
<android.support.constraint.ConstraintLayout >
<TextView
android:layout_width="200dp"
android:layout_height="50dp"
android:text = "Some text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/preview"
app:layout_constraintTop_toTopOf="@+id/parent">
/>
<Button
android:layout_width="57dp"
android:layout_height="281dp"
app:layout_constraintBottom_toBottomOf="@+id/textview"
app:layout_constraintEnd_toEndOf="@+id/textview"
app:layout_constraintStart_toStartOf="@+id/textview">
/>
</android.support.constraint.ConstraintLayout>
textview是另一个小部件。那么这将使按钮和textview的底部边界对齐。
无论如何,我可以将按钮降低10dp吗?所以我想将按钮底部锚定到textview的底部,但是我想将按钮底部降低10dp。我试图设置android:layout_marginBottom =“-10dp”,但没有成功! 有想法吗?
答案 0 :(得分:0)
在按钮布局中使用android:layout_marginTop="10dp"
答案 1 :(得分:0)
使用layout_height="wrap_content"
将它们放入FrameLayout中。然后,在两个子视图上都设置layout_gravity="bottom"
。提供您的TextView layout_marginBottom="10dp"
。
结果应该是这样的(这是一个只有相关属性的骨架):
<ConstraintLayout>
<FrameLayout
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_marginBottom="10dp"
android:layout_gravity="bottom"
/>
<Button
android:layout_gravity="bottom"
/>
</FrameLayout>
</ConstraintLayout>
答案 2 :(得分:0)
看到textview.bringToFront();
<div class="modal" id="ouibounce-modal" role="dialog" tabindex="-1">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="progress mb-3">
<div class="progress-bar" role="progressbar" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="width: 75%;">75%</div>
</div>
<form>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend" style="min-width: 50px;">
<div class="input-group-text text-center w-100"><i class="fa fa-user w-100" aria-hidden="true"></i></div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroupName" placeholder="Name">
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend" style="min-width: 50px;">
<div class="input-group-text w-100"><i class="fa fa-envelope w-100" aria-hidden="true"></i></div>
</div>
<input type="text" class="form-control" id="inlineFormInputGroupMail" placeholder="E-mail">
</div>
</div>
<button type="button" class="btn btn-primary w-100">button</button>
</form>
</div>
</div>
</div>
</div>
!function (e, n) { "function" == typeof define && define.amd ? define(n) : "object" == typeof exports ? module.exports = n(require, exports, module) : e.ouibounce = n() }(this, function (e, n, o) { return function (e, n) { "use strict"; function o(e, n) { return "undefined" == typeof e ? n : e } function i(e) { var n = 24 * e * 60 * 60 * 1e3, o = new Date; return o.setTime(o.getTime() + n), "; expires=" + o.toUTCString() } function t() { s() || (L.addEventListener("mouseleave", u), L.addEventListener("mouseenter", r), L.addEventListener("keydown", c)) } function u(e) { e.clientY > k || (D = setTimeout(m, y)) } function r() { D && (clearTimeout(D), D = null) } function c(e) { g || e.metaKey && 76 === e.keyCode && (g = !0, D = setTimeout(m, y)) } function d(e, n) { return a()[e] === n } function a() { for (var e = document.cookie.split("; "), n = {}, o = e.length - 1; o >= 0; o--) { var i = e[o].split("="); n[i[0]] = i[1] } return n } function s() { return d(T, "true") && !v } function m() { s() || (e && (e.style.display = "block"), E(), f()) } function f(e) { var n = e || {}; "undefined" != typeof n.cookieExpire && (b = i(n.cookieExpire)), n.sitewide === !0 && (w = ";path=/"), "undefined" != typeof n.cookieDomain && (x = ";domain=" + n.cookieDomain), "undefined" != typeof n.cookieName && (T = n.cookieName), document.cookie = T + "=true" + b + x + w, L.removeEventListener("mouseleave", u), L.removeEventListener("mouseenter", r), L.removeEventListener("keydown", c) } var l = n || {}, v = l.aggressive || !1, k = o(l.sensitivity, 20), p = o(l.timer, 1e3), y = o(l.delay, 0), E = l.callback || function () { }, b = i(l.cookieExpire) || "", x = l.cookieDomain ? ";domain=" + l.cookieDomain : "", T = l.cookieName ? l.cookieName : "viewedOuibounceModal", w = l.sitewide === !0 ? ";path=/" : "", D = null, L = document.documentElement; setTimeout(t, p); var g = !1; return { fire: m, disable: f, isDisabled: s } } });
var _ouibounce = ouibounce(document.getElementById('ouibounce-modal'), {
aggressive: true
});
// Hides the modal when visitor clicks outside of the modal window
$('body').on('click', function () {
$('#ouibounce-modal').hide();
});
// Hides the modal when visitor clicks on the close / footer link
$('#ouibounce-modal .modal-footer').on('click', function () {
$('#ouibounce-modal').hide();
});
// jQuery stuff to keep modal window open when it's meant to
$('#ouibounce-modal .modal').on('click', function (e) {
e.stopPropagation();
});