2017-02-21 9 views
-4

Androidスタジオの新機能です。私は最初のアプリを実行しているときに問題に直面しています。私はボタンとTextViewを作成していて、アプリケーションを実行しているときに、ボタンとTextViewに設定したテキストが表示されず、ボタンとTextViewにTextViewとButtonが表示されます。 私を助けてください。でも、テキストビューとボタンのテキストは表示されません。

ここに私のコードです。私はアンドリドスタジオで挿入されたテキストを見ることができますが、アプリを実行した後ではありません。

<TextView 
    android:text="TextView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView" 
    android:layout_marginTop="21dp" 
    tools:text="Select Your Branch" 
    android:textAppearance="@style/TextAppearance.AppCompat.Display1" 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" /> 

<Button 
    android:text="Button" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/textView" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="81dp" 
    android:id="@+id/button6" 
    tools:text="Click Me" /> 
+1

このメソッドショーのテキストは...あなたのコードを提供 –

+0

あなたはボタンやTextViewのテキストを設定してコードを共有することができ – EKN

+0

あなたのXMLとJavaコードを共有してください – Sasi

答えて

0
btn_cancel = (Button) findViewById(R.id.btn_cancel); 
     btn_cancel.setText("Cancel Button"); 

     txt_cancel = (TextView) findViewById(R.id.txt_cancel); 
     txt_cancel.setText("Cancel Text"); 

これはあなたのお役に立てば幸いです。また、ボタンとテキストビューのtextcolorをXMLで確認してください。

0

XMLファイル内にandroid:text = "MyButton"を使用してください。使用

android:text="" 

0

代わり

tools:text="" - のみの画面プレビュー

関連する問題