android是奇怪现象,在调用findviewbyid时,格局的显示效果改变了?
android是奇怪现象,在调用findviewbyid时,布局的显示效果改变了??!!
今天在做android的一个应用时,用到一个布局,要实现下图所示的效果:
左右两边时两个按钮,中间的layout时match_parent但是得在左右之间,也就是说充满左右之间的布局,下面是布局文件:
main.xml
top_bar.xml:
今天在做android的一个应用时,用到一个布局,要实现下图所示的效果:
main.xml
<?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" >
<include
layout="@layout/top_bar"/>
<FrameLayout
android:id="@+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" />
<android.support.v4.app.FragmentTabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</android.support.v4.app.FragmentTabHost>
</LinearLayout>
top_bar.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/topbar_bg" >
<ImageButton
android:id="@+id/topbar_left_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dip"
android:background="@color/transparent"
android:onClick="leftBtnClick"
android:src="@drawable/add_friend" />
<TextView
android:id="@+id/top_bar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:textColor="@color/white"
android:textSize="20sp" />
<ImageButton
android:id="@+id/topbar_right_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dip"
android:background="@color/transparent"
android:onClick="rightBtnClick"
android:src="@drawable/add_friend" />
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/topbar_right_btn"
android:layout_toRightOf="@id/topbar_left_btn"
android:orientation="horizontal"
android:visibility="visible" >
<RadioButton
android:id="@+id/auth_tab"
android:layout_width="wrap_content"
android:layout_weight="1"
android:background="@drawable/add_btn_focus"
android:button="@null"
android:checked="true"
android:gravity="center" />
<RadioButton
android:id="@+id/original_tab"