![](/img/trans.png)
[英]I want to create custom action bar like copy, paste which will work for all apps for selection of word in android
[英]android I want action bar like this
我想制作這樣的動作條..
請幫助我這樣做我試着喜歡這個但我無法得到它請幫助我完成教程。我是 android 新手。 這是Activity
代碼
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
}
}
編輯:
在github上看到這個 Demo
從那個使用toolbar
布局並復制styles.xml
樣式文件
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MyTheme">
<!-- Customize your theme here. -->
</style>
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- customize the color palette -->
<item name="colorPrimary">@color/color_primary</item>
<item name="colorPrimaryDark">@color/color_primary_dark</item>
<item name="colorAccent">@color/color_accent</item>
</style>
</resources>
工具欄.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:elevation="4dp"
android:id="@+id/tool_bar"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:background="?attr/colorPrimary"
android:layout_height="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.