使用Framelayout+linnerlayout实现按钮置于底部

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:orientation="vertical" >
	<FrameLayout
		android:layout_width="match_parent"
		android:layout_height="match_parent"
		android:layout_weight="10" >
		<ListView
			android:id="@+id/lv_task_manager"
			android:layout_width="match_parent"
			android:layout_height="match_parent"
			android:layout_marginTop="1dip"
			android:cacheColorHint="@android:color/transparent" >
		</ListView>
		<LinearLayout
			android:id="@+id/ll_task_manager_loading"
			android:layout_width="match_parent"
			android:layout_height="match_parent"
			android:gravity="center_vertical|center_horizontal"
			android:orientation="vertical"
			android:visibility="invisible" >
			<ProgressBar
				android:layout_width="60dip"
				android:layout_height="60dip" />
			<TextView
				android:layout_width="wrap_content"
				android:layout_height="wrap_content"
				android:text="正在加载应用程序"
				android:textColor="@android:color/white"
				android:textSize="18sp" />
		</LinearLayout>
	</FrameLayout>
	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:layout_weight="1"
		android:gravity="center_horizontal"
		android:orientation="horizontal" >
		<Button
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:onClick="killTask"
			android:text="一键清理" />
		<Button
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:onClick="appSetting"
			android:text="程序设置" />
	</LinearLayout>
</LinearLayout>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以为您解答。首先,您需要在布局文件中添加一个FragmentTabHost控件,用于显示底部标签栏。然后,您需要在Activity中继承FragmentActivity类,并在onCreate方法中初始化FragmentTabHost控件。最后,您需要创建多个Fragment类,用于显示不同的内容,并通过FragmentTabHost控件将它们与底部标签栏关联起来。 以下是一份示例代码,供您参考: 1. 布局文件 ```xml <android.support.v4.app.FragmentTabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"/> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content"/> </android.support.v4.app.FragmentTabHost> ``` 2. Activity类 ```java public class MainActivity extends FragmentActivity { private FragmentTabHost mTabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTabHost = findViewById(android.R.id.tabhost); mTabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent); mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("Tab 1"), Tab1Fragment.class, null); mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("Tab 2"), Tab2Fragment.class, null); mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("Tab 3"), Tab3Fragment.class, null); } } ``` 3. Fragment类 ```java public class Tab1Fragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_tab1, container, false); } } public class Tab2Fragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_tab2, container, false); } } public class Tab3Fragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_tab3, container, false); } } ``` 请注意,上述代码中的布局文件和Fragment类仅仅是示例,您需要根据自己的需求进行相应的修改。另外,由于使用了FragmentTabHost控件,因此需要引入support-v4库。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值