簡體   English   中英

ImageView未顯示在布局中

[英]ImageView not displayed into layout

我在布局上有問題。 我正在使用SlidingUpPanel,我想在TextView下方添加ImageView。 代碼是這樣的。

<RelativeLayout 
            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:fitsSystemWindows="true">

    <com.sothree.slidinguppanel.SlidingUpPanelLayout
            xmlns:sothree="http://schemas.android.com/apk/res-auto"
            android:id="@+id/panel"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="bottom"
            sothree:panelHeight="70dp"
            sothree:shadowHeight="4dp"
            sothree:paralaxOffset="100dp">       

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

            <com.simonedev.player.utils.PagerSlidingTabStrip
            android:id="@+id/pagerTabStrip"
            android:layout_width="match_parent"
            android:layout_height="50dip"
            android:background="@drawable/my_drawable"/>        

            <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/pagerTabStrip"/> 

        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#eeeeee"
            android:orientation="vertical">

            <ImageView
            android:id="@+id/myImage1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="20dp"
            android:layout_marginRight="10dp"
            android:layout_marginEnd="10dp"
            android:src="@drawable/ic_action_im"/>      

            <TextView
             android:id="@+id/text1"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginTop="5dp"
             android:layout_marginLeft="10dp"
             android:layout_marginStart="10dp"  
             android:layout_marginRight="15dp"
             android:layout_marginEnd="15dp"
             android:layout_alignParentLeft="true"
             android:fontFamily="sans-serif-condensed"
             android:singleLine="true" 
             android:ellipsize="marquee"
             android:marqueeRepeatLimit ="marquee_forever"
             android:focusable="true"
             android:focusableInTouchMode="true" 
             android:scrollHorizontally="true"
             android:textSize="18sp"/> 

            <TextView
             android:id="@+id/text2"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginTop="5dp"
             android:layout_marginLeft="10dp"
             android:layout_marginStart="10dp"
             android:layout_below="@+id/text1"
             android:fontFamily="sans-serif-light"
             android:textSize="15sp"/>      

            <RelativeLayout
            android:id="@+id/relative"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

                <TextView
             android:id="@+id/text3"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentLeft="true"
             android:layout_alignParentStart="true"
             android:layout_alignParentBottom="true"
             android:layout_marginLeft="25dp"
             android:layout_marginStart="25dp"
             android:layout_marginBottom="75dp"              
             android:textSize="17sp"
             android:text="0:00"/>      

                <SeekBar 
            android:id="@+id/seekBar" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:layout_marginLeft="5dp"
            android:layout_marginStart="5dp"
            android:layout_marginRight="55dp"
            android:layout_marginEnd="55dp"
            android:layout_marginBottom="70dp"
            android:layout_toRightOf="@+id/text3"
            android:layout_toEndOf="@+id/text3"
            android:layout_alignParentBottom="true"                     
            android:max="100"/> 

                <TextView
             android:id="@+id/text4"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_alignParentEnd="true"
             android:layout_alignParentBottom="true"
             android:layout_marginRight="22dp"
             android:layout_marginEnd="22dp"
             android:layout_marginBottom="75dp"              
             android:textSize="17sp"/>      

                <ImageView
            android:id="@+id/myImage2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="20dp"
            android:layout_marginRight="10dp"
            android:layout_marginEnd="10dp"
            android:src="@drawable/ic_action_im2"
            android:layout_below="@+id/text4"/> 

            </RelativeLayout>   

        </RelativeLayout>
    </com.sothree.slidinguppanel.SlidingUpPanelLayout>

</RelativeLayout>

現在,問題是當我運行我的應用程序時,myImage2沒有顯示,我也不明白為什么。 錯誤在哪里? 我該如何解決?

您的圖像不在顯示屏上

<ImageView          android:id="@+id/myImage2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_alignRight="@+id/seekBar"
                    android:layout_alignTop="@+id/text3"
                    android:layout_marginEnd="10dp"
                    android:layout_marginRight="121dp"
                    android:layout_marginTop="20dp"
                    android:src="@drawable/ic_action_im2" />

只需檢查上面的代碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM