嵌套线性布局,无法正确显示

时间:2016-11-22 09:02:50

标签: xml android-layout android-linearlayout

它应该是这样的 http://imgur.com/a/9rX4u

这就是我的设备http://imgur.com/a/Wxtbr

上的样子

所以右边的第二个线性布局是水平显示而不是垂直显示。它实际上似乎在android studio的预览中正确显示根据http://imgur.com/a/2YLrK

这是代码

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">
    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@mipmap/ic_launcher" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp">

    <TextView
        android:id="@+id/miwok_text_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:text="lutti" />

    <TextView
        android:id="@+id/default_text_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:text="one" />

</LinearLayout>
</LinearLayout>

0 个答案:

没有答案