-3

我無法在顯示屏上看到我的TextView。我把的LinearLayout和TextView的在RelativeLayout的,但只有LinearLayout中可以看出,而不是TextView的TextView在Android Studio的RelativeLayout中不起作用

請幫我這個代碼。在此先感謝

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    > 

    <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" 
     tools:context="com.example.dakshesh.happybirthday.MainActivity"> 

     <ImageView 
      android:src="@mipmap/ic_launcher" 
      android:layout_height="0dp" 
      android:layout_width="match_parent" 
      android:layout_weight="1" 
      android:scaleType="centerCrop" 
      /> 

     <ImageView 
      android:src="@mipmap/ic_launcher" 
      android:layout_height="0dp" 
      android:layout_width="match_parent" 
      android:layout_weight="1" 
      android:scaleType="centerCrop" 
      /> 

     <ImageView 
      android:src="@mipmap/ic_launcher" 
      android:layout_height="0dp" 
      android:layout_width="match_parent" 
      android:layout_weight="1" 
      android:scaleType="centerCrop" 
      /> 

    </LinearLayout> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:padding="16sp" 
     android:textStyle="bold" 
     android:textSize="20dp" 
     android:text="Bahubali" 
     /> 

</RelativeLayout> 
+2

如果你想顯示的'TextView'?在視圖的頂部或視圖的底部?請詳細說明。 –

+4

請粘貼您的代碼,而不是包含鏈接。 – jlively

+0

使用'ScrollView'來獲取'TextView' –

回答

-1

它因爲你沒有把你的textview下面linearlayout。 所以textview重疊在linearlayout上,這就是爲什麼你不能看到它。 只要給id來的LinearLayout

android:id="@+id/linear" 

寫裏面的TextView此行..

android:layout_below="linear" 
+0

你明白這個問題嗎?它的Linearlayout是採取整個空間不textview.So放置在線性佈局下面的textview將沒有影響。即使textview將不可見 –

+0

確定然後linearlayout高度應該是wrap_content – kkk

+0

爲什麼不使用下面的textView? –

相關問題