删除自定义选项的菜单项之间的线 [英] remove line between custom option menu items
问题描述
余定制选项菜单,除去默认背景并且通过参考一个样式定制物品它自,但我在移除堆栈项目之间的线,如图峰
任何意见将AP preciated。
我的code:
<形状的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:形状=矩形>
<行程机器人:宽=1DP机器人:身高=1DP机器人:颜色=#B22222/>
[固体机器人:颜色=#FCE6C9/>
<填充的android:左=2DP机器人:顶部=2DP机器人:右=2DP
机器人:底部=2DP/>
<边角安卓bottomRightRadius =30dp机器人:bottomLeftRadius =30dp
机器人:topLeftRadius =30dp机器人:topRightRadius =30dp/>
< /形状>
选项菜单code:
公共类OptionMenu延伸活动{
/ **第一次创建活动时调用。 * /
@覆盖
公共无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);}
公共布尔onCreateOptionsMenu(android.view.Menu菜单){
MenuInflater充气= getMenuInflater();
inflater.inflate(R.menu.cool_menu,菜单);
getLayoutInflater()。setFactory(新厂(){
公共查看onCreateView(字符串名称,上下文的背景下,
AttributeSet中的ATTRS){
如果(名称.equalsIgnoreCase(com.android.internal.view.menu.IconMenuItemView)){
尝试 {
LayoutInflater李= LayoutInflater.from(上下文);
最终的视图中查看= li.createView(姓名,空,ATTRS);
新的处理程序()。后(新的Runnable(){
公共无效的run(){
//设置背景绘制
查看.setBackgroundResource(R.drawable.border);
((TextView中)查看).setTextSize(20);
//设置文本颜色
((TextView中)查看).setTextColor(Color.RED);}
});
返回查看;}
赶上(InflateException E){}
赶上(ClassNotFoundException异常E){}
}
返回null; }
});
返回super.onCreateOptionsMenu(菜单);}
@覆盖
公共布尔onOptionsItemSelected(菜单项项){
// TODO自动生成方法存根
开关(item.getItemId()){
案例R.id.AboutUs:
意图I =新的意向书(com.test.demo.ABOUT);
startActivity(ⅰ);
打破;
案例R.id. preferences:
意图P =新的意向书(com.test.demo preFS。);
startActivity(对);
打破;
案例R.id.exit:
完();
打破;}
返回false;}}
cool_menu.xml:
< XML版本=1.0编码=UTF-8&GT?;
<菜单的xmlns:机器人=http://schemas.android.com/apk/res/android>
<项目的android:标题=关于机器人:ID =@ + ID /关于我们/>
<项目的android:标题=preFS机器人:ID =@ + ID / preferences/>
<项目的android:标题=退出机器人:ID =@ + ID /退出/>
< /菜单>
menu_style.xml:
< XML版本=1.0编码=UTF-8&GT?;
<资源>
<样式名称=Theme_menu>
<项目名称=机器人:panelFullBackground> @可绘制/边框和LT; /项目>
< /风格>
< /资源>
风格转诊的舱单选项菜单:
<活动
机器人:名称=。OptionMenu
机器人:标签=@字符串/ APP_NAME安卓主题=@风格/ Theme_menu>
正如你所说,你要找到脱离线的解决方案。我不知道这样做,但我也preFER写我自己的菜单系统,该系统是动态的,可自定义的(特别是在动画和图形)。你可以选择,对于我自己的项目写的源$ C $ C。
和设计布局,如你所愿。
示例结果:
更新:完整的答案
下一步
公共类MenuActivity扩展EnhancedActivity {
/ **第一次创建活动时调用。 * /
@覆盖
公共无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.main);
}
}
下一步
公共类EnhancedActivity延伸活动{
私有静态活动_this;
公共静态活动getCurrent(){
返回_this;
}
公共静态无效的setCurrent(活动活动){
_this =活动;
}
@覆盖
保护无效onPostCreate(包savedInstanceState){
super.onPostCreate(savedInstanceState);
_this =这一点;
G.gWidgetMenu.retarget();
}
@覆盖
保护无效onResume(){
super.onResume();
如果(_this ==本){
返回;
}
_this =这一点;
G.gWidgetMenu.retarget();
}
@覆盖
保护无效的onPause(){
G.gWidgetMenu.forceClose();
super.onPause();
}
@覆盖
公共布尔的onkeydown(INT键code,KeyEvent的E){
如果(G.gWidgetMenu.processKey(键code,E)){
返回true;
}
返回super.onKeyDown(键code,E);
}
}
下一步
公共G级扩展应用{
公共静态语境gContext;
公共静态LayoutInflater gInflator;
公共静态WidgetMenu gWidgetMenu;
@覆盖
公共无效的onCreate(){
gContext = getApplicationContext();
gInflator =(LayoutInflater)gContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
gWidgetMenu =新WidgetMenu();
}
}
下一步
公共类WidgetMenu扩展的FrameLayout实现AnimationListener {
私有静态最终诠释_RES_LAYOUT = R.layout.widget_menu;
私有静态最终诠释_RES_ANIMATION_OPEN = R.anim.anim_menu_open;
私有静态最终诠释_RES_ANIMATION_CLOSE = R.anim.anim_menu_close;
私有静态最后的动画_ANIM_OPEN = AnimationUtils.loadAnimation(G.gContext,_RES_ANIMATION_OPEN);
私有静态最后的动画_ANIM_CLOSE = AnimationUtils.loadAnimation(G.gContext,_RES_ANIMATION_CLOSE);
私有静态布尔_canReceiveKey = TRUE;
私人UI _ui;
公共WidgetMenu(){
超(G.gContext);
_ANIM_CLOSE.setAnimationListener(本);
_ANIM_OPEN.setAnimationListener(本);
查看查看= G.gInflator.inflate(_RES_LAYOUT,这一点);
_ui =新的用户界面(视图);
}
/ **
*如果菜单键pressed打开/关闭菜单,并关闭菜单时,返回键
* pressed。如果此方法的行为,它将返回true其他明智的将返回false
*作为意义没有动作发生。
* /
公共布尔processKey(INT键code,KeyEvent的E){
如果(!_canReceiveKey){
返回false;
}
开关(钥匙code){
案例KeyEvent.KEY code_MENU:
如果(getVisibility()== View.VISIBLE){
关闭();
} 其他 {
打开();
}
返回true;
案例KeyEvent.KEY code_BACK:
如果(getVisibility()== View.VISIBLE){
关闭();
返回true;
}
返回false;
}
返回false;
}
公共无效重新定位(){
FrameLayout.LayoutParams的LayoutParams =新FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT,Gravity.LEFT | Gravity.BOTTOM);
如果(EnhancedActivity.getCurrent()!= NULL){
ViewGroup中父=(ViewGroup中)的getParent();
如果(父!= NULL){
parent.removeView(本);
}
setVisibility(View.GONE);
_ui.format();
。EnhancedActivity.getCurrent()addContentView(这一点,的LayoutParams);
_canReceiveKey = TRUE;
}
}
公共无效forceClose(){
onAnimationEnd(_ANIM_CLOSE);
}
/ **播放关闭动画,并在接近监听行为,从视图中*移除/
私人无效的close(){
_canReceiveKey = FALSE;
startAnimation(_ANIM_CLOSE);
}
/ **添加控件来查看显示打开的动画* /
私人无效的open(){
_canReceiveKey = FALSE;
setVisibility(View.VISIBLE);
startAnimation(_ANIM_OPEN);
}
@覆盖
公共无效onAnimationStart(动画动画){}
@覆盖
公共无效onAnimationRepeat(动画动画){}
@覆盖
公共无效onAnimationEnd(动画动画){
如果(动画== _ANIM_CLOSE){
setVisibility(View.GONE);
}
_canReceiveKey = TRUE;
}
私有类UI {
公众的ViewGroup panel_about;
公众的ViewGroup panel_setting;
公共UI(查看视图){
panel_about =(ViewGroup中)findViewById(R.id.panel_about);
panel_setting =(ViewGroup中)findViewById(R.id.panel_setting);
格式();
}
公共无效的格式(){
panel_about.setOnClickListener(新OnClickListener(){
@覆盖
公共无效的onClick(查看为arg0){
Log.i(日志,关于菜单pressed);
}
});
panel_setting.setOnClickListener(新OnClickListener(){
@覆盖
公共无效的onClick(查看为arg0){
Log.i(日志,设置菜单pressed);
}
});
}
}
}
下一步 widget_menu.xml
< XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:ID =@ + ID / layout_root
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直机器人:后台=#000000>
< ImageView的
机器人:ID =@ + ID / imageView2
机器人:layout_width =FILL_PARENT
机器人:layout_height =2DIP
机器人:后台=#c84300/>
<的LinearLayout
机器人:ID =@ + ID / linearLayout1
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT机器人:layout_marginTop =4dip>
<的LinearLayout
机器人:ID =@ + ID / panel_feedback
机器人:layout_width =1dip
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =4dip
机器人:layout_weight =0.33
机器人:后台=#330000
机器人:重力=center_horizontal
机器人:方向=垂直
机器人:paddingBottom会=4dip
机器人:paddingTop =4dip机器人:layout_marginRight =2DIP>
< ImageView的
机器人:ID =@ + ID / ImageView01
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@可绘制/ ic_launcher/>
<的TextView
机器人:ID =@ + ID / TextView01
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =3dip
机器人:单线=真
机器人:文本=反馈
机器人:文字颜色=#FFFFFF
机器人:TEXTSIZE =17dip/>
< / LinearLayout中>
<的LinearLayout
机器人:ID =@ + ID / panel_about
机器人:layout_width =1dip
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =0.33
机器人:后台=#330000
机器人:重力=center_horizontal
机器人:方向=垂直
机器人:layout_marginLeft =2DIP机器人:layout_marginRight =2DIP机器人:paddingTop =4dip机器人:paddingBottom会=4dip>
< ImageView的
机器人:ID =@ + ID / imageView1
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:scaleType =centerInside
机器人:SRC =@可绘制/ ic_launcher/>
<的TextView
机器人:ID =@ + ID / txt_menu1
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =3dip
机器人:单线=真
机器人:文本=关于
机器人:文字颜色=#FFFFFF
机器人:TEXTSIZE =17dip/>
< / LinearLayout中>
<的LinearLayout
机器人:ID =@ + ID / panel_setting
机器人:layout_width =1dip
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =0.33
机器人:后台=#330000
机器人:重力=center_horizontal
机器人:方向=垂直
机器人:layout_marginRight =4dip机器人:paddingTop =4dip机器人:paddingBottom会=4dip机器人:layout_marginLeft =2DIP>
< ImageView的
机器人:ID =@ + ID / ImageView05
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@可绘制/ ic_launcher/>
<的TextView
机器人:ID =@ + ID / txt_menu2
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =3dip
机器人:单线=真
机器人:文本=设置
机器人:文字颜色=#FFFFFF
机器人:TEXTSIZE =17dip/>
< / LinearLayout中>
< / LinearLayout中>
< / LinearLayout中>
下一步 anim_menu_close.xml
< XML版本=1.0编码=UTF-8&GT?;
<设置的xmlns:机器人=http://schemas.android.com/apk/res/android>
<翻译
机器人:时间=200
机器人:fillAfter =真
机器人:fillBefore =真
机器人:fromXDelta =0%
机器人:fromYDelta =0%
机器人:插=@机器人:动画/ accelerate_decelerate_interpolator
安卓的repeatCount =0
机器人:toXDelta =0%
机器人:toYDelta =100%/>
< /集>
下一步 anim_menu_open.xml
< XML版本=1.0编码=UTF-8&GT?;
<设置的xmlns:机器人=http://schemas.android.com/apk/res/android>
<翻译
机器人:时间=200
机器人:fillAfter =真
机器人:fillBefore =真
机器人:fromXDelta =0%
机器人:fromYDelta =100%
机器人:插=@机器人:动画/ accelerate_decelerate_interpolator
安卓的repeatCount =0
机器人:toXDelta =0%
机器人:toYDelta =0%/>
< /集>
下一步的manifest.xml
< XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.unco coder.menu
安卓版code =1
机器人:VERSIONNAME =1.0>
<使用-SDK安卓的minSdkVersion =7/>
<应用
机器人:名称=com.unco coder.menu.G
机器人:图标=@可绘制/ ic_launcher
机器人:标签=@字符串/ APP_NAME>
<活动
机器人:名称=com.unco coder.menu.MenuActivity
机器人:标签=@字符串/ APP_NAME>
<意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<类机器人:名称=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
< /用途>
< /舱单>
I customized the option menu, removed default background and customized the item it self by referring to a style, but I stack in removal the line between the items as shown in pic.
Any advice will be appreciated.
My code :
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp" android:height="1dp" android:color="#B22222" />
<solid android:color="#FCE6C9" />
<padding android:left="2dp" android:top="2dp" android:right="2dp"
android:bottom="2dp" />
<corners android:bottomRightRadius="30dp" android:bottomLeftRadius="30dp"
android:topLeftRadius="30dp" android:topRightRadius="30dp" />
</shape>
Option menu code :
public class OptionMenu extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);}
public boolean onCreateOptionsMenu(android.view.Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.cool_menu, menu);
getLayoutInflater().setFactory(new Factory() {
public View onCreateView(String name, Context context,
AttributeSet attrs) {
if (name .equalsIgnoreCase("com.android.internal.view.menu.IconMenuItemView")) {
try {
LayoutInflater li = LayoutInflater.from(context);
final View view = li.createView(name, null, attrs);
new Handler().post(new Runnable() {
public void run() {
// set the background drawable
view .setBackgroundResource(R.drawable.border);
((TextView) view).setTextSize(20);
// set the text color
((TextView) view).setTextColor(Color.RED);}
});
return view;}
catch (InflateException e) { }
catch (ClassNotFoundException e) { }
}
return null; }
});
return super.onCreateOptionsMenu(menu);}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch (item.getItemId()) {
case R.id.AboutUs:
Intent i = new Intent("com.test.demo.ABOUT");
startActivity(i);
break;
case R.id.preferences:
Intent p = new Intent("com.test.demo.PREFS");
startActivity(p);
break;
case R.id.exit:
finish();
break;}
return false;} }
cool_menu.xml :
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:title="about" android:id="@+id/AboutUs" />
<item android:title="Prefs" android:id="@+id/preferences" />
<item android:title="Exit" android:id="@+id/exit" />
</menu>
menu_style.xml :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme_menu">
<item name="android:panelFullBackground">@drawable/border</item>
</style>
</resources>
referal of style in manifest to option menu :
<activity
android:name=".OptionMenu"
android:label="@string/app_name" android:theme="@style/Theme_menu">
As you mentioned you want to find a solution for removing line. I have no idea to do that but I also prefer to write my own menu system that is dynamic and customizable ( specially in animation and graphic ). You can pick the source code that written for my own projects.
And design your layout as you wish.
Sample Result:
UPDATE: COMPLETE ANSWER
NEXT
public class MenuActivity extends EnhancedActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
NEXT
public class EnhancedActivity extends Activity {
private static Activity _this;
public static Activity getCurrent() {
return _this;
}
public static void setCurrent(Activity activity) {
_this = activity;
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
_this = this;
G.gWidgetMenu.retarget();
}
@Override
protected void onResume() {
super.onResume();
if (_this == this) {
return;
}
_this = this;
G.gWidgetMenu.retarget();
}
@Override
protected void onPause() {
G.gWidgetMenu.forceClose();
super.onPause();
}
@Override
public boolean onKeyDown(int keycode, KeyEvent e) {
if (G.gWidgetMenu.processKey(keycode, e)) {
return true;
}
return super.onKeyDown(keycode, e);
}
}
NEXT
public class G extends Application {
public static Context gContext;
public static LayoutInflater gInflator;
public static WidgetMenu gWidgetMenu;
@Override
public void onCreate() {
gContext = getApplicationContext();
gInflator = (LayoutInflater) gContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
gWidgetMenu = new WidgetMenu();
}
}
NEXT
public class WidgetMenu extends FrameLayout implements AnimationListener {
private static final int _RES_LAYOUT = R.layout.widget_menu;
private static final int _RES_ANIMATION_OPEN = R.anim.anim_menu_open;
private static final int _RES_ANIMATION_CLOSE = R.anim.anim_menu_close;
private static final Animation _ANIM_OPEN = AnimationUtils.loadAnimation(G.gContext, _RES_ANIMATION_OPEN);
private static final Animation _ANIM_CLOSE = AnimationUtils.loadAnimation(G.gContext, _RES_ANIMATION_CLOSE);
private static boolean _canReceiveKey = true;
private Ui _ui;
public WidgetMenu() {
super(G.gContext);
_ANIM_CLOSE.setAnimationListener(this);
_ANIM_OPEN.setAnimationListener(this);
View view = G.gInflator.inflate(_RES_LAYOUT, this);
_ui = new Ui(view);
}
/**
* open/close menu if menu key pressed, and close menu when back key
* pressed. if this method act, it will return true other wise return false
* as meaning no action occured.
*/
public boolean processKey(int keycode, KeyEvent e) {
if ( !_canReceiveKey) {
return false;
}
switch (keycode) {
case KeyEvent.KEYCODE_MENU:
if (getVisibility() == View.VISIBLE) {
close();
} else {
open();
}
return true;
case KeyEvent.KEYCODE_BACK:
if (getVisibility() == View.VISIBLE) {
close();
return true;
}
return false;
}
return false;
}
public void retarget() {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM);
if (EnhancedActivity.getCurrent() != null) {
ViewGroup parent = (ViewGroup) getParent();
if (parent != null) {
parent.removeView(this);
}
setVisibility(View.GONE);
_ui.format();
EnhancedActivity.getCurrent().addContentView(this, layoutParams);
_canReceiveKey = true;
}
}
public void forceClose() {
onAnimationEnd(_ANIM_CLOSE);
}
/** play close animation and when close listener act, remove it from view */
private void close() {
_canReceiveKey = false;
startAnimation(_ANIM_CLOSE);
}
/** add control to view an show open animation */
private void open() {
_canReceiveKey = false;
setVisibility(View.VISIBLE);
startAnimation(_ANIM_OPEN);
}
@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationEnd(Animation animation) {
if (animation == _ANIM_CLOSE) {
setVisibility(View.GONE);
}
_canReceiveKey = true;
}
private class Ui {
public ViewGroup panel_about;
public ViewGroup panel_setting;
public Ui(View view) {
panel_about = (ViewGroup) findViewById(R.id.panel_about);
panel_setting = (ViewGroup) findViewById(R.id.panel_setting);
format();
}
public void format() {
panel_about.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Log.i("LOG", "About Menu Pressed");
}
});
panel_setting.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Log.i("LOG", "Setting Menu Pressed");
}
});
}
}
}
NEXT widget_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" android:background="#000000">
<ImageView
android:id="@+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="#c84300"/>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_marginTop="4dip">
<LinearLayout
android:id="@+id/panel_feedback"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:layout_weight="0.33"
android:background="#330000"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="4dip"
android:paddingTop="4dip" android:layout_marginRight="2dip">
<ImageView
android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:singleLine="true"
android:text="Feedback"
android:textColor="#ffffff"
android:textSize="17dip"/>
</LinearLayout>
<LinearLayout
android:id="@+id/panel_about"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:background="#330000"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:paddingTop="4dip" android:paddingBottom="4dip">
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/txt_menu1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:singleLine="true"
android:text="About"
android:textColor="#ffffff"
android:textSize="17dip"/>
</LinearLayout>
<LinearLayout
android:id="@+id/panel_setting"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_weight="0.33"
android:background="#330000"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_marginRight="4dip" android:paddingTop="4dip" android:paddingBottom="4dip" android:layout_marginLeft="2dip">
<ImageView
android:id="@+id/ImageView05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/txt_menu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dip"
android:singleLine="true"
android:text="Settings"
android:textColor="#ffffff"
android:textSize="17dip"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
NEXT anim_menu_close.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="200"
android:fillAfter="true"
android:fillBefore="true"
android:fromXDelta="0%"
android:fromYDelta="0%"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:repeatCount="0"
android:toXDelta="0%"
android:toYDelta="100%" />
</set>
NEXT anim_menu_open.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="200"
android:fillAfter="true"
android:fillBefore="true"
android:fromXDelta="0%"
android:fromYDelta="100%"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:repeatCount="0"
android:toXDelta="0%"
android:toYDelta="0%" />
</set>
NEXT manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.uncocoder.menu"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:name="com.uncocoder.menu.G"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name="com.uncocoder.menu.MenuActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
这篇关于删除自定义选项的菜单项之间的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!