2017-09-19 2 views
1

アプリをビルドした後、何も表示されません(textviews)。 背景画像のみが表示され、それ以外は表示されません。すべてのテキストは表示されますが、テキストは表示されません。 私は、スクロールビューの下で線形レイアウトを作成し、その下にいくつかの他のtextviews.Butは、実際に私がアプリケーションを構築しているときに表示されます。 スクロールビューの下のすべてを表示するにはどうすればよいですか? は、ここに私のコードです:スクロールビュー内に何か(textviews)が表示されます

`

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/blck" 
    android:weightSum="1" 

    tools:context="com.gnulinuxusersgroup.nitdgp.glug.faqs" 
    app:layout_collapseParallaxMultiplier="1.0"> 

    <!-- TODO: Update blank fragment layout --> 

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



    <TextView 
      android:layout_width="match_parent" 
      android:layout_height="75dp" 
      android:id="@+id/F" 
      tools:text="@string/faq" 
      tools:textColor="#ffffff" 
      tools:textSize="100px" 

      android:textAppearance="@style/TextAppearance.AppCompat" 
      android:layout_weight="0.02" /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="130px" 
      tools:text="@string/hwr" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      tools:textStyle="bold" 
      /> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="300px" 
      tools:text="@## `string/hwr2" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      /> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="130px" 
      tools:text="@string/foss" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      tools:textStyle="bold" 
      /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="269dp" 
      tools:text="@string/foss2" 
      tools:textColor="#fff" 
      tools:textSize="40px" /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="130px" 
      tools:text="@string/work1" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      tools:textStyle="bold" 
      /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="300px" 
      tools:text="@string/work2" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="130px" 
      tools:text="@string/free" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      tools:textStyle="bold" 
      /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="300px" 
      tools:text="@string/free2" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="46dp" 
      tools:text="@string/git" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      tools:textStyle="bold" 
      /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="300px" 
      tools:text="@string/git2" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      /> 
     <TextView 
      android:layout_width="394dp" 
      android:layout_height="50dp" 
      tools:text="@string/gsoc" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      tools:textStyle="bold" 
      /> 
     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="700px" 
      tools:text="@string/gsoc2" 
      tools:textColor="#fff" 
      tools:textSize="40px" 
      /> 
    </LinearLayout> 
</ScrollView> 

`

答えて

0

android:属性を使用して、さまざまなtools:属性を交換してください。

tools名前空間は、のAndroidスタジオデザインプレビューウィンドウでのみ使用されます。これにより、プレースホルダテキストを指定するなどの作業を行うことができ、現実世界で間違って表示される可能性のある実際のユーザーが見ることのできるテキストを指定せずに、どのように見えるかを確認できます。

このTextViewにしてください:最後の4つの属性のすべてがtools名前空間を使用

<TextView 
     android:layout_width="match_parent" 
     android:layout_height="130px" 
     tools:text="@string/hwr" 
     tools:textColor="#fff" 
     tools:textSize="40px" 
     tools:textStyle="bold" 
     /> 

のでアプリを実行すると、彼らは実際には何の効果もありません。今の

<TextView 
     android:layout_width="match_parent" 
     android:layout_height="130px" 
     /> 

、ちょうどandroidですべてtools名前空間を置き換えます:これは(限り実行中のアプリが懸念している)、これを書いたと同じであるベンPさんに追加

<TextView 
     android:layout_width="match_parent" 
     android:layout_height="130px" 
     android:text="@string/hwr" 
     android:textColor="#fff" 
     android:textSize="40px" 
     android:textStyle="bold" 
     /> 
0

を可能な原因は:

  1. テキストの色を白に設定しているときに背景色を確認して、コントラストがあることを確認します。
  2. LinearLayoutの向きが垂直で、ウェイト和を使用しているため、水平方向の場合はlayout_height="0dp"の方が幅が0dpになります。
  3. weightsumを指定する場合は、layout_weightが値に加算されていることを確認してください。グループ内のウィジェットの個々の重みを考慮して、システムがパーセントを自動的に計算する重みを省略できます。
  4. また、ウィジェットはテキストビューなので、垂直方向の違いはほとんど見られません。そのため、xmlの向きを水平に変更して、デバイスやレイアウトプレビューウィンドウで重量差がはっきりと分かるようにします。

    <LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal" 
    > 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/F" 
        android:text="hello1" 
        android:textSize="60px" 
        android:textAppearance="@style/TextAppearance.AppCompat" 
        android:layout_weight="1" /> 
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="hello1r" 
        android:textSize="40px" 
        android:textStyle="bold" 
        android:layout_weight="4" 
        /> 
    
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="hello3" 
        android:layout_weight="1" 
        android:textSize="40px" 
        /> 
    
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="hello4" 
        android:layout_weight="2" 
        android:textSize="40px" 
        android:textStyle="bold" 
        /> 
    
    <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_weight="2" 
        android:text="hello5" 
        android:textSize="40px" /> 
    

関連する問題