android - 如何减少android工具栏中微调器文本和微调器箭头之间的空间
问题描述
我在工具栏中放置了一个微调器。我想知道如何减少 Spinner Text 和 Spinner Arrow 之间的空间。
布局文件如下
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:minHeight="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:titleTextColor="@android:color/white"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
>
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi" />
</androidx.appcompat.widget.Toolbar>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</LinearLayout>
主要活动如下
public class MainActivity extends AppCompatActivity {
Spinner spinner;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// Sets the Toolbar to act as the ActionBar for this Activity window.
// Make sure the toolbar exists in the activity and is not null
setSupportActionBar(toolbar);
spinner = (Spinner)findViewById(R.id.spinner);
ArrayAdapter mAdapter = ArrayAdapter.createFromResource(getApplicationContext(), R.array.spinner, android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(mAdapter);
}
}
提前致谢
解决方案
推荐阅读
- python - 用于 Python 的 Bloomberg API xbbg 包装器 - 获取投资组合数据
- reactjs - 在 reactstrap 的 Select (Input) 中设置值
- php - Wordpress(插件:Docs to Wordpress)为一篇文章而不是单个文章生成多个修订
- reactjs - fetchMore 中的 updateQuery 为 Apollo 中的先前数据和新数据返回相同的值
- java - 使用 docker 时,微服务没有相互连接
- java - 如何显示枚举列表 - SpringBoot
- azure - 无法识别 Azure LoadBalancer DNS 名称
- python - Azure 休息 API。如何从工作项下载附件?Python
- python - 使用变量 X 找到 Y 的最大值
- python - 数组作为 pymoo NSGA-II 单个变量