0
我把圖片放在導航抽屜裏,但我看不到。NavigationDrawer片段標題圖片
這是我activity_main.xml中
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MyActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<LinearLayout
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="start">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/ocio"
android:layout_gravity="left|center_vertical" />
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="otcproject.v1.navigationdrawer.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
,這是我的MainActivity
public class MainActivity extends FragmentActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
運行的應用程序,我可以看到navigationdrawer但我無法看到圖像頭的選項。
你有沒有試圖給ImageView一個固定的高度? – Mann
是的,我已經把高度150dp和其他,但我看不到圖像 – Denisplata