Я новичок в Android, и я пытаюсь создать представление, но есть одна проблема, которую я не могу решить эторасположение центровка не работает.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp">
<LinearLayout
android:id="@+id/layout1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginTop="@dimen/login_view_margin_top"
android:layout_centerHorizontal="true"
android:background="@drawable/rounded_white_bg">
<EditText
android:id="@+id/loginEditText"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@drawable/dialog_edittex"
android:layout_margin="10dp"/>
<EditText
android:id="@+id/passwordEditText"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/dialog_edittex"/>
<TextView
android:id="@+id/forgetPassword"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="@android:color/black"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:textSize="@dimen/text_size_choose_order_type"/>
</LinearLayout>
<LinearLayout
android:layout_below="@id/layout1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<Button
android:id="@+id/loginButton"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:background="@drawable/dialog_button_bg"
android:textColor="@color/textColor"
android:textSize="@dimen/text_size_choose_order_type"/>
<TextView
android:id="@+id/register"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textColor="@android:color/white"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:textSize="@dimen/text_size_choose_order_type"/>
</LinearLayout>
</RelativeLayout>
centerHorizontal = истина работает нормально в андроида версии 4.0 и выше, но в 2.3.x это нет. У меня есть margin = 30dp, но marginLeft не работает в 2.3.x. Пожалуйста, не могли бы вы сказать мне, что я сделал не так?
В 4 версии
https://dl.dropboxusercontent.com/u/58583958/Screenshot%20from%202013-11-27%2012%3A29%3A02.png
в 2.3 версии
https://dl.dropboxusercontent.com/u/58583958/Screenshot%20from%202013-11-27%2012%3A29%3A10.png
Его чувак он будет работать в 2.3.x я стараюсь во много раз, так что не Проб может быть другой код имеет вероятностный –
Потому что вы даете match_parent в основной относительной макете удалить эту match_parent и использовать fill_parent вариант. –
Я не понимаю, что я бегу в своих Nexus S и Galaxy Nexus. в Galaxy Nexus прекрасно, но в Nexus S это не так. – user3024382