我把图像放在导航抽屉里,但我看不到。
这是我的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,但我看不到图像标题。
答案 0 :(得分:0)
问题是片段的 _emailAddress = Settings.EmailAddress;
string clientSecret = Settings.ClientSecret;
string clientId = Settings.ClientId;
ClientSecrets clientSecrets = new ClientSecrets {ClientId = clientId, ClientSecret = clientSecret};
UserCredential credential;
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
clientSecrets,
Scopes,
"user",
CancellationToken.None).Result;
_service = new GmailService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Draft Sender", //applicationName,
});
。尝试将其高度设置为0dp,将权重设置为1(它将占用所有可用空间,与&#34相同; match_parent
减去ImageView的高度&#34;)。
match_parent
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="start"
android:name="otcproject.v1.navigationdrawer.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />
表示视图将匹配其父级的大小,然后您不能拥有包含其内容(ImageView)的视图和与其父级(片段)匹配的另一个视图。第二个将与第一个重叠。