好的,所以我想在我的 6 个按钮、页眉和页脚后面设置一个背景图像,当有人点击它或类似的东西时,我不希望发生任何事情。假设背景 png 图像是“@drawable/background”。
这是目前屏幕的图片:http: //i.stack.imgur.com/66MoI.png
这是我当前的相关代码:
仪表板布局.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_root"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Include Action Bar -->
<include layout="@layout/actionbar_layout"/>
<!-- Include Fragmented dashboard -->
<include layout="@layout/fragment_layout"/>
<!-- Include Footer -->
<include layout="@layout/footer_layout"/>
MenuActivity.java
public class MenuActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard_layout);
/**
* Creating all buttons instances
* */
Button btn_chat = (Button) findViewById(R.id.btn_chat);
Button btn_forums = (Button) findViewById(R.id.btn_forums);
Button btn_donate = (Button) findViewById(R.id.btn_donate);
Button btn_reports = (Button) findViewById(R.id.btn_reports);
Button btn_commands = (Button) findViewById(R.id.btn_commands);
Button btn_photos = (Button) findViewById(R.id.btn_photos);
/**
* Handling all button click events
* */
btn_chat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), ChatActivity.class);
startActivity(i);
}
});
btn_forums.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), ForumsActivity.class);
startActivity(i);
}
});
btn_donate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), DonateActivity.class);
startActivity(i);
}
});
btn_reports.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), ReportsActivity.class);
startActivity(i);
}
});
btn_commands.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), CommandsActivity.class);
startActivity(i);
}
});
btn_photos.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), PhotosActivity.class);
startActivity(i);
}
});
}
}
提前一英里谢谢你们:)