Android 如何在listview的同一行中放置箭头?
我做了一个项目,然后被困在那里。 在我的设计论文里 我并没有像看上去的那样放置箭头,所以我可以只在文本侧进行操作 那样 如何放置箭头? 我的密码是Android 如何在listview的同一行中放置箭头?,android,android-layout,listview,Android,Android Layout,Listview,我做了一个项目,然后被困在那里。 在我的设计论文里 我并没有像看上去的那样放置箭头,所以我可以只在文本侧进行操作 那样 如何放置箭头? 我的密码是 String[] maddeler = new String[] { "YÖNETİM KURULU BAŞKANI FİKRİ ÖZTÜRK'ÜN MESAJI", "GENEL MÜDÜR CÜNEYT AĞCA İLE RÖPORTAJ", "21. YILINDA OPET", "MİSYONUMUZ VİZYONUMUZ
String[] maddeler = new String[] { "YÖNETİM KURULU BAŞKANI FİKRİ ÖZTÜRK'ÜN MESAJI", "GENEL MÜDÜR CÜNEYT AĞCA İLE RÖPORTAJ", "21. YILINDA OPET",
"MİSYONUMUZ VİZYONUMUZ DEĞERLERİMİZ"};
ArrayList<String> maddelerListe = new ArrayList<String>();
maddelerListe.addAll( Arrays.asList(maddeler) );
listAdapter = new ArrayAdapter<String>(this, R.layout.simplerow, maddelerListe);
mainListView.setAdapter( listAdapter );
mainListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
switch(position)
{
case 0:
Intent baskanlar =new Intent(getBaseContext(),BaskanlarSplash.class);
startActivity(baskanlar);
break;
case 1:
Intent baskanlar2=new Intent(getBaseContext(),BaskanlarSplash2.class);
startActivity(baskanlar2);
break;
case 2:
Toast.makeText(getBaseContext(),"içerik bekleniyor",Toast.LENGTH_LONG).show();
break;
case 3:
Toast.makeText(getBaseContext(),"içerik bekleniyor",Toast.LENGTH_LONG).show();
break;
}
}
});
String[]maddeler=新字符串[]{“YÖNETİM KURULU BAŞKANI FİKRİZTÜk'N MESAJI”、“GENEL MÜDÜR C࢞NEYT AĞCAİLE RÖPORTAJ”、“21.YILINDA OPET”,
“MİSYONUMUZ VİZYONUMUZ DEĞERLERİMİZ”};
ArrayList maddelerListe=新的ArrayList();
addAll(Arrays.asList(maddeler));
listAdapter=newarrayadapter(this,R.layout.simplerow,maddelerListe);
mainListView.setAdapter(listAdapter);
mainListView.setOnItemClickListener(新的AdapterView.OnItemClickListener(){
@凌驾
public void onItemClick(AdapterView父对象、视图、整型位置、长id){
开关(位置)
{
案例0:
Intent baskanlar=newintent(getBaseContext(),BaskanlarSplash.class);
星触觉(baskanlar);
打破
案例1:
Intent baskanlar2=新Intent(getBaseContext(),BaskanlarSplash2.class);
星触觉(baskanlar2);
打破
案例2:
Toast.makeText(getBaseContext(),“içerik bekleniyor”,Toast.LENGTH_LONG.show();
打破
案例3:
Toast.makeText(getBaseContext(),“içerik bekleniyor”,Toast.LENGTH_LONG.show();
打破
}
}
});
**我的simplerow.xml**
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp"
android:textColor="@color/homeBac"
>
</TextView>
这是我的Listview普通版
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/mainListView">
</ListView>
如果你能帮助我,我很高兴:)像这样更改行布局:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_your_arrow"/>
</LinearLayout>
将simplerow的基本布局设置为相对布局,并像这样设置值。如果愿意,可以将箭头设置为可绘制的图像视图。可能需要更改设置,但这应该可以工作
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:padding="10dp"
android:textSize="16sp"
android:textColor="@color/homeBac" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:padding="10dp"
android:textSize="16sp"
android:textColor="@color/homeBac"
android:text=">" />
</RelativeLayout>
将行更改为
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textColor="@color/colorAccent"
android:textSize="16sp"
android:layout_weight="1"></TextView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_dialog_info" />
</LinearLayout>
ArrayAdapter<String> listAdapter =
new ArrayAdapter<String>(this, R.layout.simplerow,R.id.rowTextView, maddelerListe);
然后将适配器声明更改为
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textColor="@color/colorAccent"
android:textSize="16sp"
android:layout_weight="1"></TextView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_dialog_info" />
</LinearLayout>
ArrayAdapter<String> listAdapter =
new ArrayAdapter<String>(this, R.layout.simplerow,R.id.rowTextView, maddelerListe);
ArrayAdapter列表适配器=
新的ArrayAdapter(this,R.layout.simplerow,R.id.rowTextView,maddelerListe);