我正在創建一個應用程序,其中有一個片段,用戶可以使用按鈕打開微調器並選擇一個食物項目。食物項目將在列表中的按鈕下顯示。我曾嘗試過創建文字瀏覽和製作無形文字瀏覽並稍後設置文字,但都沒有成功。我想知道是否有人知道更好的創建方式,我沒有看到。顯示數據的高效方式
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lastineindustries.ingredismartv2.Kitchen">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:text="Add An Ingredient"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/add"
android:textSize="30sp"
android:layout_gravity="center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="320dp"
android:layout_height="match_parent"
android:id="@+id/main"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="60dp"
android:layout_height="match_parent"
android:id="@+id/valueButton"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
</LinearLayout>
嵌套的LinearLayouts絕對不好......你能畫一幅你真正想要展示的圖片嗎? –
*食物項目然後將顯示在按鈕列表中* ... ListView和ArrayAdapter是爲此目的而構建的,而不是動態LinearLayout –
我仍然使用在代碼中編輯的TextViews嗎? – Keith