Android 相对论中的tabhost
早上好, 我能把一个tabhost放在一个relativelayout中而不出错吗? 我不能让它工作。放置代码,图像就是我想要的(tabhost上方的webview,它必须位于按钮下方)Android 相对论中的tabhost,android,android-layout,android-widget,Android,Android Layout,Android Widget,早上好, 我能把一个tabhost放在一个relativelayout中而不出错吗? 我不能让它工作。放置代码,图像就是我想要的(tabhost上方的webview,它必须位于按钮下方) 编辑 这是一个错误: “”未设置所需的布局宽度属性: (1) 设置为“包装内容” (2) 设置为“匹配父项” “”未设置所需的布局高度属性: (1) 设置为“包装内容” (2) 设置为“匹配父项” “”未设置所需的布局宽度属性: (1) 设置为“包装内容” (2) 设置为“匹配父项” “”未设置所需的布局
编辑
这是一个错误:
“”未设置所需的布局宽度属性:
(1) 设置为“包装内容”
(2) 设置为“匹配父项”
“”未设置所需的布局高度属性:
(1) 设置为“包装内容”
(2) 设置为“匹配父项”
“”未设置所需的布局宽度属性:
(1) 设置为“包装内容”
(2) 设置为“匹配父项”
“”未设置所需的布局高度属性:
(1) 设置为“包装内容”
(2) 设置为“匹配父项”
TabHost需要id为“android:id/tabs”的TabWidget
必须提供布局宽度属性。
必须提供布局高度属性。
异常详细信息记录在窗口>显示视图>错误日志中您需要tabHost中的webview?我这样做了。。。。但是当我运行这个时,我得到一个错误:错误?可以发布错误或日志跟踪。使用TabHost的android:layout\u alignParentBottom=“true”你在这里讲的是
TabWidget'
s对齐吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button1"
android:layout_width="100px"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="-" />
<Button
android:id="@+id/button2"
android:layout_width="100px"
android:layout_height="wrap_content"
android:layout_above="@+id/webView1"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/button1"
android:text="+" />
<TabHost
android:id="@+id/tabHost"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true" />
<FrameLayout android:layout_width="wrap_content"
android:layout_height = "wrap_content"
android:id= "@android:id/tabcontent">
<LinearLayout
android:id="@+id/tabX1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="500px"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/tabX2"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</FrameLayout>
<TabWidget android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height ="wrap_content">
</TabWidget>
</TabHost>
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/button2"
android:ems="10" >
<requestFocus />
</EditText>
</RelativeLayout>
</LinearLayout>