Android Studio 3.4
styles.xml
<style name="Main.Theme.Tango" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Customize your theme here -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!-- theme UI controls like buttons, checkboxes and text fields or cursor -->
<item name="colorAccent">@color/colorAccent</item>
</style>
在清单中:
<application
android:name=".main.MainApp"
android:allowBackup="true"
android:icon="@drawable/ic_app"
android:label="@string/application_name"
android:logo="@drawable/ic_app_logo"
android:theme="@style/Main.Theme.Tango" >
在activity:
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
public class MainNavigationDrawerFragmentActivity extends AppCompatActivity{
private void initialize(Bundle savedInstanceState) {
mTitle = mDrawerTitle = getTitle();
mToolbar = (Toolbar) findViewById(R.id.toolBar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
mToolbar, R.string.application_name,
R.string.application_name) {
public void onDrawerClosed(View view) {
mToolbar.setTitle(mTitle);
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
mToolbar.setTitle(mDrawerTitle);
invalidateOptionsMenu();
loadDraftsTotalNumber();
loadActiveCart();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
这里是布局:
<androidx.drawerlayout.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="0dp"
android:layout_height="56dp"
android:background="#dc2700"
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="288dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/list_background"
android:choiceMode="singleChoice"
android:divider="@null"
android:listSelector="@drawable/list_selector"
android:paddingLeft="16dip"
android:paddingRight="16dip"/>
</androidx.drawerlayout.widget.DrawerLayout>
但工具栏未显示:
在布局中试试这个。对我有用。
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/color3"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="0dp"
android:layout_height="56dp"
android:background="#dc2700"
/>
</com.google.android.material.appbar.AppBarLayout>
单击时,我的应用可在相机和图库之间进行选择,然后该图片将显示在 ImageView 中。我最初尝试显示完整图像,然后尝试使用位图方式,但没有任何效果。我只是得到一个空白的图像视图。请给我一些关于我做错了什么的指导,并在必要时要求澄清: 相机/画廊照片代码:
问题内容: 我正在尝试请求权限以获取用户的当前位置。 我的日志记录表明,在查询时,我的应用当前没有此权限,但是在不调用任何内容时,则显示。 我的Google地图代码(实现和)位于中。 我设法使该功能在该应用程序的其他“活动”中成功运行,这只是带有Google地图的功能。将其放在或中的方法中(它需要去的地方),该方法不起作用。 有任何想法吗?这与我的Activity的类()有关,还是与Google地
问题内容: 我在程序中发现了一些问题。 我使用log4j进行日志记录, 但是,在日志文件中,所有行号都变为“?”。 对话模式如下: 问题答案: 您很可能在已编译的工件中缺少调试信息。也就是说,这不是log4j的错,您需要确保正在编译包含调试信息的东西。一个快速的测试是尝试使用您喜欢的IDE调试您的应用程序。如果没有调试信息,它将抱怨并且不会建立调试会话。
我已经制作了Hello World RCP应用程序,得到了以下类结构: 向Perspective.createInitialLayout()添加额外代码: 但不显示视图。 我将breakpoint设置到perspective.createInitialLayout()中,发现它没有执行。 我的观点声明是: ApplicationWorkbenchAdvisor.GetInitialWindowPe
我正在测试一个框架,并试图加载其他glTF文件,而不是教程中提供的示例。我从Sketchfab下载了几个glTF包文件,它们似乎没有加载。 如果我使用给定文件链接的框架,它会起作用:https://cdn.aframe.io/test-models/models/virtualcity/VC.gltf 但不是我从Sketchfab下载的。文件的路径是正确的-我有一个资产文件夹旁边的我的index.
我正在学习Spring框架。我添加了在。但当我去看的时候,它是看不见的http://localhost:8080.我的结构如下: taco cloud\src\main\java\tacos\tacoCloud应用程序。JAVA taco cloud\src\main\java\tacos\HomeController。JAVA Taco-Cloud\src\main\资源\静态\home.htm