0

I'm new to android

I'm facing a problem in inflate layout to set close mark

How to set close mark in inflater? how to implement this?

Any one help me.

I try like this..

  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);  

activity-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>

Its coming like for each text view in list above cross mark is displaying....

Avadhani Y
  • 7,566
  • 19
  • 63
  • 90
Make it Simple
  • 1,832
  • 5
  • 32
  • 57

1 Answers1

0

You should place your close mark in activity-nexttopic.xml layout instead of row_topic.xml. whatever you place in row_topic.xml will be repeated for every row in Listview.