toolbar 相关问题

工具栏标签用于与工具栏的配置,设计和使用相关的问题。

自定义使用 NavigationToolbar2Tk 创建的工具栏的图标

我想自定义 matplotlib 工具栏上的图标(如主页、后退、前进、平移等)。在这种情况下,我正在编写一个带有 tkinter 的 GUI,在 GUI 的小部件中嵌入了 pyplot 图并创建...

回答 0 投票 0

ViewPager2 主要活动工具栏不工作

我想在视图活动中按下我的自定义工具栏按钮,但我做不到 如何将我的自定义工具栏带到 ViewActivity 上? 请帮助我 这是我的活动视图 我想在视图活动中按下我的自定义工具栏按钮,但我做不到 如何将我的自定义工具栏带到 ViewActivity 上? 请帮助我 这是我的活动视图 <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <com.google.android.material.appbar.AppBarLayout android:id="@+id/appbarLayout" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:elevation="0dp" app:layout_constraintTop_toTopOf="parent"> <androidx.appcompat.widget.Toolbar android:id="@+id/alarmToolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:layout_gravity="center" app:contentInsetStart="0dp" app:menu="@menu/alarm_title"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="미운 오리 새끼" android:fontFamily="@font/applesdgothicneoeb" android:textColor="@color/black" android:textSize="25sp" /> </androidx.appcompat.widget.Toolbar> </com.google.android.material.appbar.AppBarLayout> <androidx.viewpager2.widget.ViewPager2 android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/> </androidx.constraintlayout.widget.ConstraintLayout> 这是我的ViewActivity package com.example.test; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.viewpager2.adapter.FragmentStateAdapter; import androidx.viewpager2.widget.ViewPager2; import java.util.ArrayList; import java.util.List; public class ViewActivity extends AppCompatActivity { private ViewPager2 pager; private FragmentStateAdapter pagerAdapter; private ZoomOutPageTransformer pageTransformer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view); Toolbar toolbar = findViewById(R.id.alarmToolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); List<Fragment> fragments = new ArrayList<>(); fragments.add(new Duck1Fragment()); fragments.add(new Duck2Fragment()); fragments.add(new Duck3Fragment()); pager = findViewById(R.id.pager); pagerAdapter = new PagerAdapter(this, fragments); pager.setAdapter(pagerAdapter); pager.setPageTransformer(pageTransformer); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.alarm_title, menu); return true; } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.close: finish(); return true; default: return super .onOptionsItemSelected(item); } } } 这是我的 Duck1Activity <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" > <ImageView android:id="@+id/imageView" android:layout_width="150dp" android:layout_height="150dp" android:layout_marginTop="70dp" android:src="@drawable/tale_character" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.498" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <FrameLayout android:id="@+id/frameLayout" android:layout_width="300dp" android:layout_height="300dp" android:layout_marginTop="150dp" android:background="@drawable/background" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.495" app:layout_constraintStart_toStartOf="parent" tools:layout_editor_absoluteY="161dp" app:layout_constraintTop_toTopOf="parent"> <ImageView android:id="@+id/ducktale_image" android:layout_width="275dp" android:layout_height="275dp" android:layout_gravity="center" tools:srcCompat="@tools:sample/avatars" /> </FrameLayout> <FrameLayout android:layout_width="300dp" android:layout_height="175dp" android:layout_marginBottom="50dp" android:background="@drawable/background" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.495" app:layout_constraintStart_toStartOf="parent"> <TextView android:id="@+id/duck_tale" android:layout_width="275dp" android:layout_height="150dp" android:scrollbars="vertical" android:layout_gravity="center" android:fontFamily="@font/applesdgothicneoeb" android:text="안녕하세요 이것은 테스트입니다." android:textAlignment="center" android:textSize="25sp" /> </FrameLayout> </androidx.constraintlayout.widget.ConstraintLayout> 这是我的 duckFragment package com.example.test; import static android.speech.tts.TextToSpeech.ERROR; import android.content.Context; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.text.method.ScrollingMovementMethod; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toolbar; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import java.util.Locale; public class Duck1Fragment extends Fragment { private TextToSpeech tts; private TextView duck; Context ct; public Duck1Fragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_duck1, container, false); ct = getActivity().getApplication(); ImageView duck_image = (ImageView) rootView.findViewById(R.id.ducktale_image); TextView duck = (TextView) rootView.findViewById(R.id.duck_tale); duck.setText( ); duck.setMovementMethod(new ScrollingMovementMethod()); tts = new TextToSpeech(ct, new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if(status != ERROR) { tts.setLanguage(Locale.KOREAN); } } }); duck_image.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { tts.setSpeechRate(1.0f); tts.speak(duck.getText().toString(), TextToSpeech.QUEUE_FLUSH, null); } }); return rootView; } } 这是我的 PageAdapter package com.example.test; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentActivity; import androidx.viewpager2.adapter.FragmentStateAdapter; import java.util.List; public class PagerAdapter extends FragmentStateAdapter { private List<Fragment> fragments; private static final int NUM_PAGES = 3; public PagerAdapter(FragmentActivity fragmentActivity, List<Fragment> fragments) { super(fragmentActivity); this.fragments = fragments; } @NonNull @Override public Fragment createFragment(int position) { [tag:tag-name] if (position == 0) return new Duck1Fragment(); else if (position == 1) return new Duck2Fragment(); else return new Duck3Fragment(); } @Override public int getItemCount() { return NUM_PAGES; } } 我想按工具栏上的自定义按钮.. 所以你们可以帮助我吗? 我搜索了 google 和 chatgpt 但我无法解决它

回答 0 投票 0

材料查看页 点击返回退出活动

当我使用Florent的ViewPager库点击返回时,无法退出Pager活动,我是这样调用PagerActivity的: public class MainActivity extends AppCompatActivity { @Override ....

回答 2 投票 2

在Angular应用程序中显示2个工具条的问题

我有一个angular项目,其中我有两个工具栏。第一个是整个应用程序的固定工具栏。我把这段代码放在一个组件工具栏里:......

回答 1 投票 0

点击工具栏中的呼叫导航图标(安卓)。

我有以下代码:setSupportActionBar(toolbar); toolbar.setNavigationOnClickListener(onClickListener); 和XML。

回答 1 投票 0

mat-toolbar不与mat-grid-list一起显示。

我有一个包含工具栏和网格列表的组件,像这样。 ... ...

回答 1 投票 0

Angular多组件渲染视图问题

我有2个组件:第一个组件包含一个工具条,第二个组件包含其他工具条元素。我在app.component.html中这样调用我的2个组件。

回答 1 投票 0

AndroidX - 工具栏汉堡菜单打开两次的故障

我在使用AndroidX工具栏时遇到了一个小问题,我实际设置的工具栏如下... app_toolbar.xml

回答 1 投票 0

让禁用的菜单和工具栏图像看起来更好?

请看附件的截图,它说明了我的一个程序中的TToolBar。请注意工具条的最后两张图片,它们是被禁用的。它们被绘制成禁用的方式......。

回答 5 投票 19

Codenmae之一如何使在图标上面添加一个芽,并将其放置在工具栏中。

这就是我的尝试通知 = Command.create("", materialIcon(FontImage.MATERIAL_NOTIFICATIONS, 3, 0xffffff), evt -> { //......。}); mainForm.getToolbar()......。

回答 2 投票 1

安卓材质工具栏表面颜色在两个不同的工具栏上看起来是不一样的

我试图用:android:background="?attrcolorSurface "将材质工具栏的背景色改为表面色,结果和预期的一样(为了简化,我将背景......)。

回答 1 投票 1

为什么android.widget.SearchView不能一键展开,而是将图标移到左侧?

我正在MaterialToolbar中使用android.widget.SearchView,并且还在菜单源文件中设置了正确的属性。但是,当我单击搜索图标时,它不会展开。而是...

回答 1 投票 0

为什么我的win32 gui程序的工具栏中会出现灰色框,而不是图标图像?

我正在为USB控制的逻辑分析仪构建一个win32 gui,我想在那里实现一个工具栏。因此,我选择了一个教程,并在Code :: Blocks中尝试了此代码。它工作正常,但...

回答 1 投票 0

Vue-apexcharts工具栏:选择工具不起作用

我创建了带有vue apexcharts的折线图,并且试图在工具栏中启用选择工具(如此处所述:https://apexcharts.com/docs/options/chart/toolbar/),但是即使我设置了:...

回答 1 投票 0

运行按钮未显示在xcode 11.5的工具栏上

是xcode的新手,当我看着工具栏时,所有按钮都丢失了。我进入了视图->显示工具栏,但是按钮仍然不见了!

回答 1 投票 0

MFC将CMFCToolBar按钮更改为切换,而不是按下/释放?

[我在网上找到了一篇文章,说将工具栏按钮设置为持续按下的类型,您只需在按钮上设置样式TBBS_CHECKBOX即可,但对我不起作用(它仍然像普通的样式...

回答 1 投票 0

将工具栏向上移动工具栏

我正在普通视图控制器中使用表格视图。我在屏幕底部有一个带有文本字段的工具栏。当我点击textField时,键盘出现并覆盖了textfield...。

回答 1 投票 0

从Android工具栏中删除左边距

我正在开发一个Android应用,其中有导航抽屉,可以导航到我应用的其他部分。我已将ActionBarDrawerToggle默认汉堡包图标更改为我自己的图标。我想放置...

回答 1 投票 0

在ActionMode中删除工具栏标题页边空白

我想删除导航图标和我的actionMode标题之间的空格。由于以下原因,我设法将其从工具栏中删除:

回答 1 投票 1

动作图标未出现在工具栏中

[Good Day,我正在使用导航组件的应用程序上工作,我设置了工具栏图标,但是没有出现,因此我尝试按照此处的指南解决问题,但此处仍然没有出现...]]

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.