我想将动态视图添加到Horizontal LinearLayout中.但我的问题是如果水平没有空间,它应该自动垂直放置.
我的形象
我的预期结果
我的代码是
for (int j = 0; j < jobDet.getKeywords().length; j++) {
RelativeLayout tr_head = (RelativeLayout) getLayoutInflater().inflate(R.layout.tag_lay, null);
TextView label_date = (TextView) tr_head.findViewById(R.id.tag_name);
label_date.setText(jobDet.getKeywords()[j]);
keywordL.addView(tr_head, new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT));
}
Run Code Online (Sandbox Code Playgroud)
我的"tag_lay.xml"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:id="@+id/tag_name"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:background="@drawable/round_edit_box"
android:text=" PHP "
android:gravity="center"
android:lines="1"
android:layout_marginRight="5dp"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我可以从决斗SIM手机获得运营商名称.
我使用了以下代码,但它仅适用于单个SIM卡手机.
TelephonyManager telephonyManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE));
Run Code Online (Sandbox Code Playgroud)