Android布局TextView从LinearLayout跳转

时间:2016-07-05 13:52:20

标签: android layout android-linearlayout

enter image description here我的布局有问题。带有此ID的文字" @ + id / ConnectInfo" "跳转"来自" @ drawable / top_panel"。我无法理解为什么会如此。任何人都可以帮助我在目标区域修复我的文字吗?

这是我的完整布局:

<FrameLayout
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:accessibilityLiveRegion="assertive">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.test.myapplication.CustomLogoView
        android:id="@+id/custom_logo_view1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"

    />
</RelativeLayout>

<!--
Слой приложения    
-->

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"

        android:paddingBottom="0dp"
        android:paddingLeft="0dp"
        android:paddingRight="0dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@drawable/top_panel"
            android:orientation="horizontal"
            android:paddingBottom="0dp"
            android:paddingLeft="0dp"
            android:paddingRight="0dp">

            <TextView
                android:id="@+id/connectInfo"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Medium Text"
                android:textAppearance="?android:attr/textAppearanceMedium"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="4"
            android:orientation="horizontal"
            android:paddingBottom="0dp"
            android:paddingLeft="0dp"
            android:paddingRight="0dp">


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical"
                android:paddingBottom="0dp"
                android:paddingLeft="0dp"
                android:paddingRight="0dp">


                <ImageButton
                    android:id="@+id/btnStart"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="bottom"
                    android:layout_weight="1"
                    android:background="#00000000"
                    android:scaleType="fitStart"
                    android:src="@drawable/btn_sqr_search_land"/>


                <ImageButton
                    android:id="@+id/btnOldDev"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="bottom"
                    android:layout_weight="1"
                    android:background="#00000000"
                    android:scaleType="fitStart"
                    android:src="@drawable/btn_sqr_list_land"/>
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5"
                android:orientation="vertical"
                android:paddingBottom="0dp"
                android:paddingLeft="0dp"
                android:paddingRight="0dp">

                <RelativeLayout
                    android:id="@+id/relativeLayout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:paddingBottom="16dp"
                    android:paddingLeft="0dp"
                    android:paddingRight="22dp"
                    android:paddingTop="16dp">
                    <ListView
                        android:id="@+id/listView1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:divider="@null"
                        android:dividerHeight="0dp">
                    </ListView>

                </RelativeLayout>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

更改此行 android:layout_height="0dp"android:layout_height="wrap_content"

.
.
.
<LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"  //change this line
        android:layout_weight="1"
        android:paddingLeft="0dp"
        android:paddingRight="0dp"
        android:paddingBottom="0dp"
        android:background="@drawable/top_panel">


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text="Medium Text"
            android:id="@+id/connectInfo"

            />



</LinearLayout>
.
.
.