Java MarginLeft不';t工作:为什么?
我有这个布局Java MarginLeft不';t工作:为什么?,java,android,xml,Java,Android,Xml,我有这个布局 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ScrollView androi
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textView2"
android:layout_marginLeft="13dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="0dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="16sp"
android:text="@string/text"
/>
</ScrollView>
</RelativeLayout>
我想知道为什么在一些手机或Android版本(主要是2.3姜饼)上,边距实际上是0,因为它没有从左边距分离,而是附加了边距,好像没有Android:layout\u marginLeft=“13dp”尝试将Android:layout\u gravity=“left”添加到文本视图中。layout\u gravity的值可以是任何有效列表。在xml中尝试以下内容。我已经添加了
android:layout\u gravity=“left”
<TextView
android:id="@+id/textView2"
android:layout_marginLeft="13dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:textSize="16sp"
android:text="text"
/>