2016-11-12 158 views
0

我有一個佈局,帶有id =「credit_wallet」的textview。TextView不能在佈局中顯示

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/md_brown_900" 
    android:orientation="vertical" > 

    <include 
     android:id="@+id/lay_include" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
       layout="@layout/top_points_bar" /> 
    <TextView 
     android:id="@+id/credit_wallet" 
     android:gravity="center" 
     android:textColor="@color/md_brown_700" 
     android:layout_marginTop="65dp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     /> 
    <com.justfashion.Logo 
android:id="@+id/logo" 
     android:text="Fashion Wallet" 
     android:gravity="center" 
     android:textSize="20dp" 
     android:textColor="@color/md_brown_700" 
     android:layout_marginTop="60dp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     /> 

    <ListView 
     android:id="@+id/listearncredit" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginTop="70dp" 
     android:layout_below="@+id/logo" 
     android:cacheColorHint="@color/AliceBlue" 
     android:textColor="@color/AntiqueWhite" 

     android:dividerHeight="0dp" 
     android:divider="@color/Aqua"/> 

</RelativeLayout> 

我的JAVA:

http://pastebin.com/raw/bgf4njkT

它不會顯示在credit_wallet值。哪裏不對?請幫助我們!

Btw。當我添加一些示例文本時,它正在顯示但不是該值。

+1

你能提供一個截圖嗎? –

+0

它可能是一個textColor問題。嘗試設置您的textColor相應 – HelloSadness

+0

也爲什麼你使用android:layout_alignParentTop =「true」爲包含的佈局和TextView。似乎不是正確的做法。這可能會導致問題 –

回答

0

實際上,它顯示,但textColor是白色的「與背景相同,在你的情況下,它是棕色的」。嘗試設置它!

+0

不,不要看它,它是不同的顏色,只有類似的名字:) –

0

它loosks喜歡你的背景是棕色的,而你的TextView textcolor也是褐色...
試着改變你的textColor白色ANS看它是否是一個文字顏色的問題。布朗棕色=>一種無形的價值...

+0

不,不要看它,它是不同的顏色,只有類似的名字:) –

0

只是檢查這條線在Java代碼中

creditWallet.setText(PreferenceConnector.readInteger(aiContext, PreferenceConnector.WALLETPOINTS,0)+""); 

你是否得到任何文字或沒有。那裏有一個調試

+0

但是,我不看到調試中的任何錯誤。 –