而且我没有把箭头看成是如此,所以我只能在文字方面做到这一点。
喜欢那个
如何放箭头?
我的代码是
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;
}
}
});
**我的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 Normaly
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/mainListView">
</ListView>
如果你能帮助我,我会变得如此贪心:)
答案 0 :(得分:3)
将行更改为
<?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);
答案 1 :(得分:0)
像这样更改行布局:
<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>
答案 2 :(得分:0)
将simplerow的基本布局设为RelativeLayout,并将值设置为类似于此。如果您愿意,可以将箭头设置为可绘制的ImageView。可能需要更改设置,但这应该有效。
<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>