我想在我的抽屉导航页脚上添加社交喜欢和联系按钮。喜欢这张图片(http://postimg.org/image/3mcbdod21/) 请帮助我.
是的,我使用的是安卓导航抽屉
我在抽屉导航中添加页脚,它看起来像(http://postimg.org/image/chsryx1qx/)
这是我的代码页脚1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#7A7A7A"
android:orientation="horizontal"
android:gravity="center">
<ImageView
android:id="@+id/facebook"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/fb"
android:layout_margin="5dp"
/>
<ImageView
android:id="@+id/twitter"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/twitter"
android:layout_margin="5dp"
/>
<ImageView
android:id="@+id/google"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/google"
android:layout_margin="5dp"/>
</LinearLayout>'
footer.java
package com.hdwh.android.wallpaper;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.Toast;
import android.content.Intent;
public class Footer extends BaseActivity {
ImageButton imgButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.footer1);
addListenerOnButton();
}
private void addListenerOnButton() {
imgButton = (ImageButton) findViewById
(R.id.facebook);
imgButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
String url = "http://www.facebook.com.";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
private void addListenerOnButton1() {
imgButton = (ImageButton) findViewById
(R.id.twitter);
imgButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
String url = "http://www.twitter.com.";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
private void addListenerOnButton2() {
imgButton = (ImageButton) findViewById
(R.id.google);
imgButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
String url = "http://plus.google.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}
}
您可以在抽屉菜单的xml文件中设置布局并将其设置为布局对齐父底部(您是否使用android导航抽屉?