我是安卓新手
我在充气布局中遇到问题以设置关闭标记
如何在充气机中设置关闭标记?如何实施?
任何人帮助我。
我试试这样。。
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); viewList = Nexttopic.this.getLayoutInflater().inflate(R.layout.activity_nexttopic, null); dialogMarketList = new Dialog(Nexttopic.this); dialogMarketList.requestWindowFeature(Window.FEATURE_NO_TITLE); dialogMarketList.setTitle("TOPICS"); dialogMarketList.setContentView(viewList); dialogMarketList.show(); lvForDialog = (ListView) viewList.findViewById(R.id.List_view); lvForDialog.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL); ArrayAdapter<String> adapter = (new ArrayAdapter<String>(Nexttopic.this, R.layout.row_topic, R.id.child_row,tnamelist)); lvForDialog.setAdapter(adapter);
活动-nexttopic.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:android1="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Nexttopic" > <ListView android1:id="@+id/List_view" android1:layout_width="match_parent" android1:layout_height="330dp" android1:layout_centerHorizontal="true" android1:layout_centerVertical="true" android:background="@drawable/bg"> </ListView> </RelativeLayout>
row_topic.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1"> <TextView android:id="@+id/c_txt" android:layout_width="fill_parent" android:layout_height="50dp" android:text="X" android:textSize="25dp" android:gravity="right"/> <TextView android:id="@+id/child_row" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/c_txt" android:layout_marginTop="27dp" android:background="@drawable/bg" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" android:paddingLeft="6dip" android:textColor="@android:color/white" /> </RelativeLayout>
它的出现就像十字标记上方列表中的每个文本视图正在显示....