我有这段代码的问题。我有我的XML注册的ID,但代码不起作用。主要是红色的,add_photo是红色的,目标图像和目标图像都是红色的(红色的一切都是斜体的)。XML准备就绪,Java未成功
setContentView(R.layout.*main*);
Button buttonAddPhoto = (Button)findViewById(R.id.*add_photo*);
textTargetUri = (TextView)findViewById(R.id.*targeturi*);
targetImage = (ImageView)findViewById(R.id.*targetimage*);
XML:
<TextView
android:text= "Thot of The Day!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="60sp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:id="@+id/text_shout_out"
/>
<Button
android:id="@+id/add_photo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Add Photo"
android:gravity="center"
android:layout_below="@+id/text_shout_out"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="131dp"
android:onClick="Image"/>
也发布您的布局文件。 –
你真的在你的代码中使用星号吗? –
用布局文件编辑你的问题。不要把它当作评论。 –