[英]Vertically Space "Weight" between Linear Layout Buttons
I was wondering how to add space between buttons vertically, I was following instructor and the buttons on his screen seems good.我想知道如何在按钮之间垂直添加空间,我跟着教练,他屏幕上的按钮看起来不错。 Also, when I downloaded his project files the problem still facing me.
另外,当我下载他的项目文件时,我仍然面临着这个问题。
I am new to this weight technology in XML.我是 XML 中这种重量技术的新手。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:id="@+id/tvInput"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#EFEFEF"
android:textSize="48sp"
android:maxLength="12"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:orientation="horizontal"
>
<Button
android:id="@+id/btnSeven"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="7"
android:onClick="onDigit"
/>
<Button
android:id="@+id/btnEight"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="8"
android:onClick="onDigit"
/>
<Button
android:id="@+id/btnNine"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="9"
android:onClick="onDigit"
/>
<Button
android:id="@+id/btnDivide"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="/"
android:onClick="onDigit"
/>
</LinearLayout>
</LinearLayout>
android:layout_marginHorizontal="5dp"
<!--change the dp size prefered your design-->
android:layout_marginVertical="5dp"
<!--change the dp size prefered your design-->
<!--left-->
android:layout_marginLeft="5dp"
<!--change the dp size prefered your design-->
<!--top-->
android:layout_marginTop="5dp"
<!--change the dp size prefered your design-->
<!--right-->
android:layout_marginRight="5dp"
<!--change the dp size prefered your design-->
<!--bottom-->
android:layout_marginBottom="5dp"
<!--change the dp size prefered your design-->
if, I solved your problem please give tick mark & up-vote this answer.如果,我解决了你的问题,请给这个答案打勾并投票。 Thanks in advance.
提前致谢。 ;)
;)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.