Java/Android导航抽屉故障(新手)
嗨,我是编程新手 我遵循这一伟大的原则,一切都很好 现在我试着做两件事:Java/Android导航抽屉故障(新手),java,android,android-studio,Java,Android,Android Studio,嗨,我是编程新手 我遵循这一伟大的原则,一切都很好 现在我试着做两件事: 在NavDrawer的顶部创建一张图片(要在此处调用profilepicture和名称,同时将其设置为按钮) 和向顶部菜单添加按钮 我尝试了很多不同的方法,但都没有成功 你有什么关于如何做到这一点的建议吗 我正在使用Android studio。 提前谢谢 Strings.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Rider</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="drawer_open">Rider Menu Opened</string>
<string name="drawer_close">Rider Menu Closed</string>
<!-- Nav Drawer Menu Items -->
<string-array name="nav_drawer_items">
<item >Profile</item>
<item >Club</item>
<item >Points of interest</item>
<item >Calender</item>
<item >Help</item>
<item >Share</item>
</string-array>
<!-- Nav Drawer List Item Icons -->
<!-- Keep them in order as the titles are in -->
<array name="nav_drawer_icons">
<item>@drawable/ic_home</item>
<item>@drawable/ic_people</item>
<item>@drawable/ic_photos</item>
<item>@drawable/ic_communities</item>
<item>@drawable/ic_pages</item>
<item>@drawable/ic_whats_hot</item>
</array>
<!-- Content Description -->
<string name="desc_list_item_icon">Item Icon</string>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/txtLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="16dp"
android:text="Profile"
android:textStyle="bold" />
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/txtLabel"
android:src="@drawable/ic_home"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"/>
</RelativeLayout>
package info.androidhive.slidingmenu;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class ProfileFragment extends Fragment {
public ProfileFragment(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_profile, container, false);
return rootView;
}
}
这会帮助你解决第一个问题。。。我不知道该怎么做?我重写了整个项目,接着又解决了一个问题——导致了几个新问题。现在我在第一个菜单项中有了我的图像。这将帮助您解决第一个问题。。。我不知道该怎么做?我重写了整个项目,接着又解决了一个问题——导致了几个新问题。现在,我的图像出现在第一个菜单项中。