ListActivity布局没有边距

时间:2014-06-27 11:20:27

标签: android android-layout

编辑:问题似乎与:

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
<\ n>在OnCreate中......但不知道为什么......

我有这段代码:

public class BluetoothDiscovery extends ListActivity {

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    String MAC = this.discoveredPrinters.get(position);
    Intent i = new Intent();
    i.putExtra("mac", MAC);
    setResult(RESULT_OK, i);

    // Finalizamos el Activity
    finish();
}

private ArrayList<String> discoveredPrinters = null;
private ArrayAdapter<String> mArrayAdapter;
private static DiscoveryHandler btDiscoveryHandler = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    // Configuramos el theme del activity
    Utils.setCustomTheme(this, getApplicationContext(), true);        

    setContentView(R.layout.discovery_results);
    ---

布局xml文件如下:

<?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="vertical"
android:gravity="center"
>  

<ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="match_parent" 
    android:layout_margin="10dp"/>

<TextView
    android:id="@id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="No printers found" 
    android:layout_margin="10dp"/>

但我不明白为什么标题如此接近活动的边界。为了有必要,Manifest以这种方式表达了这个活动:

    <activity
        android:name=".printing.BluetoothDiscovery"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.Holo"
        android:windowSoftInputMode="adjustPan|stateHidden" >
    </activity>

这是从首选项调用活动的方式:

public class AdjustmentsActivity extends PreferenceActivity implements
    OnSharedPreferenceChangeListener {

....
....

    etPRINTER = (Preference) findPreference("key_select_printer");
    etPRINTER.setOnPreferenceClickListener(new OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference preference) {

            String PrinterMAC = Utils
                    .ObtenerMACPrinterSharedPreferences(getApplicationContext());

            Intent intentLocatePrinter = new Intent(
                    getApplicationContext(), BluetoothDiscovery.class);

            intentLocatePrinter.putExtra("titulo",
                    "Búsqueda de impresora Bluetooth");

            startActivityForResult(intentLocatePrinter,
                    REQUEST_SELECTED_PRINTER);

            return true;
        }
    });

接下来是我在视觉上获得的,由于整个视图周围缺乏边缘,这有点奇怪。我的问题是我的问题在哪里(Manifest,xml,class)?。

提前致谢,

何。

This is what I see

0 个答案:

没有答案