我为Android设备上查看简单的XML文件:为什么我在TextView保证金?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:id="@+id/recipe_step_number_textView"
android:text="STEP #NUM"
/>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/recipe_step_title_editText"
android:hint="add step title"/>
</LinearLayout>
他,你怎么看,有很简单的TextView和EditText上,但是TextView的有余量排名前几个像素,看起来是这样的:
为什么我有保证金最高?
UPD非常感谢!正如我发现有很多方法来解决这些小问题,几乎所有他们适合
此边距因重力而变,因为您使用的是android:gravity =“center”,所以textview的所有文本都在textview的中心偏移,因此您在文本顶部看到边距 –