快速的問題。我使用了標籤活動。 所以我創建了片段佈局。然後我用getItem
方法class SectionsPagerAdapter
與switch .... case
來允許在這些佈局之間滑動。片段佈局不對應於android studio中的設計
在設計上的問題。在AVD結果是從結果在IDE設計預覽不同的...下面是我的XML片段和截圖...
順便說一句,我用inflater
在onCreateView
爲:return inflater.inflate(R.layout.tab_etudiant,container,false);
佈局XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@drawable/etudiants"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:scaleType="centerCrop"/>
<Button
android:id="@+id/btnNouveauEtu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="INSCRIRE"
android:layout_weight="1"/>
<Button
android:id="@+id/btnModifEtu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="EDITER"
android:layout_weight="1"/>
<Button
android:id="@+id/btnListerEtu"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="LISTER"
android:layout_weight="1"/>
</LinearLayout>
參見在左畫面(在IDE)有3個按鈕(Incrire, Editer, Lister
)。在右側(即在AVD中)第三個按鈕(Lister
)被切斷
的區別是什麼? – tyczj
@tyczj請參閱左側有** 3 **按鈕。在右側(即在AVD中)第三個按鈕被切割 –
看起來像模擬器有一個不同於你創建的視圖的DPI。一切看起來很正常 – tyczj