mDocView 与cramperView 重叠,就好像它在另一个之上一样。我希望 mDocView 在 topHeader 下面。
我的 cramper.xml-
<ViewSwitcher
android:id="@+id/switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
<Button
android:id="@+id/backfromreport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/btn_black_xml"
android:padding="10dp"
android:text="Back"
android:clickable="true"
android:onClick="goBack"
android:textColor="#ffffff"
android:textSize="16dp" />
<TextView
android:id="@+id/messager"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_weight="1"
android:gravity="center"
android:text="Messager"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
</LinearLayout>
</ViewSwitcher>
相关的 Cramper Java 文件:
private View cramperView;
private LinearLayout topHeader;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
topHeader = (LinearLayout) findViewById(R.id.linearLayout1);
private ReaderView mDocView = new ReaderView(this); //ReaderView extends AdapterView
cramperView= getLayoutInflater().inflate(R.layout.cramper,null);
RelativeLayout layout = new RelativeLayout(this);
layout.addView(cramperView);
layout.addView(mDocView);
setContentView(layout);