2가 TextView
인데 그 중 하나에 텍스트가 표시되지 않습니다. 내가 거기에있는 LogCat
에서 볼 수 있지만 그것은 표시되지 않습니다. 문제가 내 xml
파일에 있다고 확신하지만 정확히 무엇을 모르겠습니다. 또한 나는 이것과 같은 많은 포스트를 여기에서 보았다. 그리고 나는 그들과 다른 것을 시험해 보았다. 그러나 non는 나를 도와 줬다. 여기 레이아웃TextView에 텍스트가 표시되지 않습니다
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="320dp"
android:layout_height="wrap_content"
android:minHeight="50dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="300dp"
android:layout_height="0dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_weight="10.18"
android:background="@drawable/buttons"
android:orientation="vertical" >
<TextView
android:id="@+id/name"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="" />
<TextView
android:id="@+id/text"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:layout_marginTop="10dp"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="fill_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<Button
android:id="@+id/pressMe"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:background="@drawable/bg_button"
android:gravity="center"
android:padding="4dp"
android:text="@string/PressMe" />
<Button
android:id="@+id/dontPress"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/bg_button"
android:gravity="center"
android:padding="4dp"
android:text="@string/DontPressMe" />
</LinearLayout>
</LinearLayout>
</ScrollView>
문제가 TextView
내가 getExtra
intent.putExtra("text", stocks[position].text);
intent.putExtra("name", stocks[position].name);
하고 그래서
Bundle b = getIntent().getExtras();
if (b != null) {
name = b.getString("name");
textView.setText(name+"");
text = b.getString("text");
textView.setText(text+"");
을 putExtra
통해 다른 활동에서 그들을 얻고 또한 "@+id/name"
입니다은 있지만 name
가 없습니다. 첫 번째 활동에는 둘 다 있습니다.
textView = (TextView) findViewById(R.id.name);
textView = (TextView) findViewById(R.id.text);
활동 코드를 넣을 수 있습니까? –
TEXT를 XML로만 설정해보세요. 표시 되나요? –
지연에 대한 사과 .. 내 PC 충돌. 예, 텍스트를 XML에 넣으면 둘 다 볼 수 있습니다. 다른 하나는 있어야합니다. – Goro