我正在创建一个应用程序,其中有一个片段,用户可以使用按钮打开微调器并选择一个食物项目。食物项目将在列表中的按钮下显示。我曾尝试过创建文字浏览和制作无形文字浏览并稍后设置文字,但都没有成功。我想知道是否有人知道更好的创建方式,我没有看到。显示数据的高效方式
<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